Xref: utzoo comp.os.os9:226 comp.lang.c:13660 Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!lll-winken!lll-tis!ames!mailrus!bbn!oberon!skat.usc.edu!blarson From: blarson@skat.usc.edu (Bob Larson) Newsgroups: comp.os.os9,comp.lang.c Subject: Re: Bugs in OS9/68K C-Compiler ? Message-ID: <13117@oberon.USC.EDU> Date: 28 Oct 88 05:23:27 GMT Article-I.D.: oberon.13117 References: <147@fbihh.UUCP> <636@tuvie> Sender: news@oberon.USC.EDU Reply-To: blarson@skat.usc.edu (Bob Larson) Organization: USC AIS, Los Angeles Lines: 26 In article <636@tuvie> rzmul3@tuvie (Uni Leoben) writes: >For the 'return 0 != ptr' problem : I don't know why, but 'return ptr != 0' >works. Apparently the compiler automatically casts integers to pointers >on comparisons but doesn't cast pointers to integers. I don't know what >K&R says to this case. Perhaps someone with more C insight could comment >on this. The order of the comparison dosn't matter, 0 must be converted to the approprate type. char *ptr; return 0 != ptr; is equivelent to: char *ptr; return (char *)0 != ptr; (I'm quite sure K&R, H&S, K&R-II, and the ANSI drafts all argee on this.) [Microware is gradually converting from a K&R based compiler to an ANSI one, when I talked to him a few years ago Kim Kempf (microware's C compiler guru) was on the ANSI committee.] -- Bob Larson Arpa: Blarson@Ecla.Usc.Edu blarson@skat.usc.edu Uucp: {sdcrdcf,cit-vax}!oberon!skat!blarson Prime mailing list: info-prime-request%ais1@ecla.usc.edu oberon!ais1!info-prime-request