Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!csun!csusac!hoodr From: hoodr@csusac.uucp (Robert Hood) Newsgroups: comp.sys.next Subject: C Compiler BUG Keywords: BUG Message-ID: <1989Jul12.193615.27988@csusac.uucp> Date: 13 Jul 89 02:36:13 GMT Organization: California State University, Sacramento Lines: 74 I ran into some strange compiler behavior on the NeXT. It seems that the C compiler can't handle #ifdef's or #defines inside of a command very well. The following piece code was taken from NetHack 2.3e: #define index strchr (defined in header file) otmp>dknown = index( #ifdef KAA #ifdef SPELLS "/=!?*+)", #else "/=!?*)", #endif #else #ifdef SPELLS "/=!?*+", #else "/=!?*", #endif #endif let) ? 0 : 1; the compiler gives three errors for this code: unterminated #if conditional #else not within a conditional too many (5) args to macro 'index' Notice the lhe last error. ALL of the possiblilities were processed! (too bad we don't have "cpp" so we can see what the preprocessor is doing!) Another piece of code from a different part of nethack also produced a compiler error (notice the #ifdef inside of a command): (void) sprintf(buf, "killed by%s", !strncmp(killer, "the ", 4) ? "" : !strcmp(killer, "starvation") ? "" : !strncmp(killer, "Mr.") ? "" : !strncmp(killer, "Ms.") ? "" : #ifdef STOOGES !strcmp(killer, "Larry") ? "" : !strcmp(killer, "Curly") ? "" : !strcmp(killer, "Moe") ? "" : #endif index(vowels, *killer) ? " an" : " a"); I've also had lots of trouble compiling normal BSD 4.3 source. Many times source that will compile on a "standard" BSD 4.3 will produce lots of compiler "type mismatch" errors.. One more thing: Why isn't there a "/usr/etc/libresolv.a". The NeXT supports networking and nameserving very well, but I would like to compile other networking/nameserver programs too. Robert Hood California State University: Sacramento UUCP: ..ucdavis!csusac!cssexb!hoodr BITNET: nctp003@CCS.CSUSCC.CALSTATE.EDU -- ------------------------------------------------------------------------ Robert Hood -- California State University: Sacramento (ooooh...) UUCP: ..csusac!hoodr BITNet: NCTP003@CCS.CSUSCC.CALSTATE.EDU