Quote:
& _ISDIGIT returns a positive value for any char that is an ASCII character that is a number. *buf points to the VALUE of what buf is currently aimed at.
In C, 0 is False, everything else is True. There is no BOOL value. BOOL is unsigned int, in other words, a number.
What the code does:
Checks if the code is a digit. If it fails the digit test, check for a
'.'. Return the value of the test to control the loop.
buf++ just moves to the next character. At string end the character is '\0' - the null character. It is not a number so it fails the test, you exit the loop. If you hit a non-number you exit the loop early.
If you went all the way thru the string to the end, then
return (*buf==0x00) is True. if not it's False because you exit the loop early.
While this kind of stuff can be fun & instructive (maybe), you should'nt re-invent the wheel. All of this stuff has been done to death, so consider looking around for algorithms. Especially if you are getting money for your code.
I figured that out with playing with the code. The only thing I really don't understand is what happens here (*buf & _ISDIGIT). What exactly happens at this point?