From: Zilvinas V. <zva...@ca...> - 2001-06-09 01:19:51
|
On Fri, Jun 08, 2001 at 03:01:03AM -0700, Joaquin Cuenca Abela wrote: > > --- "R. Reucher" <ren...@cp...> wrote: > > Andrew James Richardson wrote: > > > > > Brian, > > > > > > I thought that in the C specs you can't be > > guarenteed the order of > > > evaluation in an if brace. Surely a safer bet is > > > > > > if(!image){ > > > if(!image->Data){ > > > ... > > > } > > > } > > You're right here. But as as long as you only READ > > it should make no > > difference (IMHO)... > > if it's right, it makes a big difference. If you try: > > if (!image->Data || !image) > > the program will segfault trying to access the member > Data of a null pointer. Exactly. > > Though I think that the order evaluation IS specified > in the standard. > If it were C++ and you had overloaded those operators ... it might change some of that picture. but even in this case, with overload !, || operators C++ standard says that that each operator must be evaluated. > Cheers, > > -- > Joaquin Cuenca Abela > e98...@ya... > > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail - only $35 > a year! http://personal.mail.yahoo.com/ > > _______________________________________________ > Dri-devel mailing list > Dri...@li... > http://lists.sourceforge.net/lists/listinfo/dri-devel -- Zilvinas Valinskas |