TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Wim Veldhuis
from: Mike Bilow
date: 1995-03-11 17:39:58
subject: WATCOM is ?

Wim Veldhuis wrote in a message to Mike Bilow:

 PH> Drat!  I think you're right.  Oh well, I was just
 PH> unlucky/stupid enough to have chosen  and  for
 PH> two of my own files, so I'll just nip in and change 150-odd
 PH> source files :-(.  

 MB> There's always the rather vicious "#define 
 MB> " approach...  

 WV> Yep, but macro expansion does not work inside string
 WV> literals. At least not in Borland C++, but I wouldn't be
 WV> amazed if it didn't work in other compilers also. 

Macro expansion of preprocessing tokens on an #include line is required by
ANSI, except in cases where the corner brackets or quote marks appear.

The official ANSI rule (6.8.2) is:

   The method by which a sequence of preprocessing tokens between a 
   preprocessing token pair or a pair of " characters is combined into a
   single header name preprocessing token is implementation-defined.

The following is given by ANSI as an example which must be supported:

#if   VERSION == 1
      #define INCFILE "vers1.h"
#elif VERSION == 2
      #define INCFILE "vers2.h"
#else
      #define INCFILE "versN.h"
#endif
#include INCFILE

If Borland does not handle this correctly, it is a reportable bug.
 
-- Mike


---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 955
SEEN-BY: 712/407 515 628 704 713/888 800/1 7877/2809
@PATH: 323/107 150 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.