Newsgroups: comp.os.msdos.djgpp From: fredex AT fcshome DOT stoneham DOT ma DOT us (fred smith) Subject: Re: Preprocessor hates sizeof X-Newsreader: TIN [version 1.2 PL2] Organization: None! Message-ID: References: Date: Thu, 25 Mar 1999 02:59:26 GMT Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Wojciech Piechowski (voyt AT ds2 DOT pg DOT gda DOT pl) wrote: : Hi : I wonder why the following line does not compile and how to make it work: : #if sizeof(long int)==sizeof(int) : (Borland likes it) As I recall, the ANSI/ISO standard for the C language specifies that sizeof() is evaluated AFTER the conditional compilation directives, not before. That being the case you cannot use this construct in any ANSI- conforming program/compiler. There is a standard include named limits.h which contains information that can be used to write some somewhat different code that will in the end do what you want, but you can't do it in this way. Check out limits.h and look for INT_MAX and LONG_MAX. Fred -- ---- Fred Smith -- fredex AT fcshome DOT stoneham DOT ma DOT us ----------------------------- I can do all things through Christ who strengthens me. ------------------------------ Philippians 4:13 -------------------------------