Static typing (was Re: Java guy interested in Python)

D-Man dsh8290 at rit.edu
Tue Mar 13 11:45:39 EST 2001


On Sun, Mar 11, 2001 at 11:06:53PM +0000, Michael Hudson wrote:
| "Alex Martelli" <aleaxit at yahoo.com> writes:
| 
| > Sorry, too subtle -- the point was meant to be that a #define int
| > foo _would_ make it legal (and incomprehensible to anybody, if the
| > #define is well-hidden enough) -- sort of trying to see who'd fail
| > to spot this.  But on re-reading it falls pretty flat -- sorry!
| 
| Actually, I thought
| 
| #define int foo
| 
| was pedantically illegal C++ that was almost certain to work, but on
| checking I see that it's probably legal.  I also hadn't taken this
| possibility into account when replying above; catching people out with
| the preprocessor isn't really fair...
| 

If you use g++ 2.96, 

#define or  anything
#define not anything

is illegal unless you give it the -fno-operator-keyword flag.  I found
this out when I tried to compile a particular C++ program available on
the 'net.

I don't know if this is the GNU people trying to help C++ programmers
out, or if it is a stricter adherence to the standard, or a deviation
from the standard.

-D





More information about the Python-list mailing list