Xref: utzoo comp.os.os9:220 comp.lang.c:13600 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!nrl-cmf!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.os.os9,comp.lang.c Subject: Re: Bugs in OS9/68K C-Compiler ? Message-ID: <8782@smoke.BRL.MIL> Date: 28 Oct 88 00:31:33 GMT References: <147@fbihh.UUCP> <636@tuvie> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 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. That certainly is a confused compiler. != is a symmetric operator. It is not a matter of a cast (do YOU see a cast?) nor even of a type conversion. Any pointer may be compared for (in)equality with a null pointer, and 0 is one way to write a null pointer constant (in ANSI C, (void*)0 is another). I think most programmers would find return ptr != 0; clearer than return 0 != ptr; but these are technically equivalent.