delorie.com/archives/browse.cgi | search |
Xref: | news-dnh.mv.net comp.os.msdos.djgpp:4390 |
From: | "Gordon L. Scott" <Gordon AT apis DOT demon DOT co DOT uk> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: (none) |
Date: | Fri, 12 Jan 96 09:30:36 GMT |
Lines: | 29 |
Message-ID: | <821439036.snews.post.Gordon@apis.demon.co.uk> |
References: | <DKzMM1 DOT KrA AT jade DOT mv DOT net> <4d3kiv$qv7 AT agate DOT berkeley DOT edu> |
Reply-To: | Gordon Scott <Gordon AT apis DOT demon DOT co DOT uk> |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
In article <4d3kiv$qv7 AT agate DOT berkeley DOT edu> korpela AT islay DOT ssl DOT berkeley DOT edu "Eric J. Korpela" writes: > In article <DKzMM1 DOT KrA AT jade DOT mv DOT net>, <kagel AT quasar DOT bloomberg DOT com> wrote: > > > > if (!my_pointer) > > my_pointer = (my_struct_t *)malloc( sizeof (my_struct_t) ); > > > >Or BETTER CODE but equivalent: > > > > if (my_pointer == (my_struct_t *)NULL) > > Is this really better? Could option 1 fail? I thought the C standard > guaranteed that the top option would work. > > Eric The readability is better but the following typo is *not:* if (my_pointer = (my_struct_t *)NULL) Fortunately, most modern compilers warn about this. -- Gordon Scott Gordon AT apis DOT demon DOT co DOT uk Compuserve 100332,3310 Gordon AT multitone DOT co DOT uk Basingstoke Beekeeper Beekeeper AT apis DOT demon DOT co DOT uk
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |