>> After all, ain't unary logical operations with pointers illegal? I haven't got my ANSI spec to hand ... but if the complier "eats" this code without complaining then it's valid C!
Richard ----- Original Message ----- From: "Indrek Rebane" <ind...@bps.co.ee> To: <mspgcc-users@lists.sourceforge.net> Sent: Saturday, March 27, 2004 12:48 PM Subject: Re: [Mspgcc-users] Why #define NULL 0? > Hey folks, > > Russell Nelson wrote: > > Even if there was a good reason to change it, there's way too > > much code that does this kind of thing: > > > > foo = malloc(10); if (!foo) exit(1); > > Which is a really bad programming practice. After all, ain't unary > logical operations with pointers illegal? Better way would be: > > if (foo == NULL) > > Which gives nice int value to if for evaluation in C (bool in C++). > > Indrek > > -- > Indrek Rebane | Borthwick-Pignon > Electronics Engineer | Tartu Science Park > Phone: (+372) 7 302 641 | Riia 185, 51014 Tartu > Fax: (+372) 7 383 041 | Estonia > ind...@bps.co.ee | www.bps.co.ee > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.631 / Virus Database: 404 - Release Date: 17/03/04