Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!mit-eddie!uw-beaver!tektronix!orca!tekecs!doghouse!snoopy From: seifert@doghouse.gwd.tek.com (Snoopy) Newsgroups: comp.unix.wizards Subject: compiler predefines (was: Re: 4.3BSD stdio.h - sprintf() definition) Message-ID: <8888@tekecs.TEK.COM> Date: Tue, 21-Jul-87 19:55:20 EDT Article-I.D.: tekecs.8888 Posted: Tue Jul 21 19:55:20 1987 Date-Received: Fri, 24-Jul-87 01:27:57 EDT References: <521@quacky.UUCP> <526@quacky.UUCP> <23741@sun.uucp> Sender: nobody@tekecs.TEK.COM Reply-To: snoopy@doghouse.gwd.tek.com (Snoopy) Organization: The Daisy Hill Puppy Farm Lines: 53 Keywords: [ comp.bugs.4bsd removed from newsgroups line. This should probably move to one of the C groups. ] In article <23741@sun.uucp> guy%gorodish@Sun.COM (Guy Harris) writes: > There *should* either be a predicate built into the C > preprocessor/compiler or a #define constant in some system include > file; YES! YES! Anyone for "LITTLE_ENDIAN" and "BIG_ENDIAN" ? And all the predefines should be documented. >is that 1) there's no guarantee that there will be a unique #define >for a particular machine (consider "mc68000" vs. "m68k") and 2) it >doesn't help when a new machine comes along. (I don't even know what >the magic predefine is for the NS32K series, or even if everybody >uses the same one, so I didn't put it in up there; Our compiler defines both ns16000 and ns32000. "m68k" should mean 680x0, while "mc68000" should mean the 68000 specifically. > I don't know if > there *is* one for the WE32K series - AT&T seems to use stuff like > > #if u3b20 || u3b2 || u3b5 || u3b15 || ... > > but enumerating all the 3Bs seems like a silly way of defining the > set of machines using the WE32K Last time I looked, the 3b20 didn't use the WE32K chip(s). It predated them, if I remember correctly. Various boards had various micros (8085, 8086, 2911, etc). Obviously they should define "3b" or similar. (and probably we32k as well) > (unless, of course, that set stops growing at some point, > which is certainly possible).) I read an article in one of the tabloids recently saying that sales of the 3Bs were low, and they might be canceled (pending the result of an internal battle). But back to the main point, #ifdefs should reflect what you're REALLY testing for. Use #ifdef LITTLE_ENDIAN, or #ifdef MASSBUS, not #ifdef vax, or worse, some internal codename for a machine. Snoopy tektronix!doghouse.gwd!snoopy snoopy@doghouse.gwd.tek.com "And it's a middle-endian machine with trinary logic." "They would do that!"