Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!mindcraft.com!fred From: fred@mindcraft.com (Fred Zlotnick) Newsgroups: comp.std.c Subject: Re: Want the word on __STDC__ Message-ID: <668288453.3046@mindcraft.com> Date: 6 Mar 91 19:40:52 GMT References: <4755@lib.tmc.edu> <15260@smoke.brl.mil> <4203@lupine.NCD.COM> <15381@smoke.brl.mil> Organization: Mindcraft, Inc. Lines: 33 In article <15381@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: >In article <4203@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: >>I assume that you also get irrate about implementors who define __STDC__ >>to something other than 1. > >I have no problem with an otherwise CONFORMING implementation defining >__STDC__ to something other than 1, although why would it? At least >that does not cause problems for strictly conforming applications. But it CAN cause problems (in addition to which, such an implementation is no longer conforming according to section 3.8.8): since we know that nonconforming implementations do in fact sometimes define __STDC__ to something other than 1, it would be useful to protect your code by using the test #if __STDC__ == 1 rather than #ifdef __STDC__ This works if __STDC__ is not defined, since (according to 3.8.1) it is "replaced with the pp-number 0". But it won't give the desired result if an "otherwise CONFORMING implementation" has __STDC__ defined to a value not 1. You could argue that nonconforming implementations are free to do whatever they like, including defining __STDC__ to be 1. But this would be nasty, and in practice no intentionally nonconforming implementation is likely to do it. Fred Zlotnick | #include fred@mindcraft.com | #include ...!{decwrl,ames,hpda}!mindcrf!fred |