Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_hash.c

From: Date: Tue, 05 Nov 2002 18:05:22 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_hash.c
References: 1 2  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-559@lists.php.net to get a copy of this message
On November 5, 2002 01:23 am, Andi Gutmans wrote: > At 08:33 AM 11/5/2002 -0500, Ilia A. wrote: > >On November 5, 2002 08:22 am, Zeev Suraski wrote: > > > At 14:20 05/11/2002, Ilia A. wrote: > > > >First there is the compiler warning about un-initialized variable, > > > > which would > > > >occur if ordered is null. If that can never happen then this is just a > > > >compiler warning fix. If it can happen, then this prevents a possible > > > >undefined behaviour because p2 would be used without having it's value > > > > set, meaning that that any random value could be in there. > > > > > > It doesn't happen, I also don't recall ever seeing a compiler warning > > > about it (the compiler should be bright enough to see that for > > > itself...). What compiler are we talking about here? > > > >gcc 2.95.3 > >I got the error when I compiled ZE2 with -O3 -g3 -Wall flags. > > I think if the compiler is wrong we shouldn't fix it. Theoretically such an > assignment slows down the function. So why should we make the code worse > just so that we don't see a warning (and I have personally never seen this > warning). > In general, I don't think everything should be done to get rid of warnings > if it doesn't make sense. > I feel the same about other patches I've seen in the past which make the > code much uglier just to get rid of the warning (I'm not talking about this > patch but patches which cast a million places). Each compiler has its own quircks I s'pose, going out of our way to fix irrelevant compiler related problems is probably not a good idea. In this case however, the situation is such that if a certain condition is not met we could get a segmentation fault because we'd be using a random value. If you feel that this cannot happen, let me know, I'll revert the patch. Ilia

« previous php.zend-engine.cvs (#559) next »