[PD] float parsing

Mathieu Bouchard matju at artengine.ca
Thu Dec 28 06:03:16 CET 2006


On Wed, 27 Dec 2006, Miller Puckette wrote:

> Dunno which is should be, but the 'c' language doesn't
> allow unary '+' in front of numerical literals... so I
> followed that lead.

I don't know which C language you are talking about. Try compiling the 
following program with options -ansi -pedantic-errors:

#if + +1
int main (void) {
   int foo[+ +1] = { + + + + + + + + + + +1 };
   return foo[0];
}
#endif

This demonstrates that unary + works in front of numerical literal, both 
in the main language and in the preprocessor. I don't know of a way to 
test whether the last + before the 1 is actually considered part of the 
literal or not. However, both scanf() and strtod() consider + as part of 
a float literal (was there ever a time that they didn't? really?).

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada


More information about the Pd-list mailing list