[ros-dev] Re: [ros-svn] [gdalsnes] 18113:-reorderInsertXscendingOrder macro argument order and update uses

Gunnar Dalsnes hardon at online.no
Wed Sep 28 20:13:15 CEST 2005

Phillip Susi wrote:
> Gunnar Dalsnes wrote:
>> The new operator is just a word as anything else. Just because its a 
>> compiler feature doesnt make it "magic". It just means that every C++ 
>> compiler should reserve and support it just like we can say ReactOS 
>> reserve and support Xxx for usage Xxx. And you can overload new u 
>> know. Then you never know what it _really_ does;-P
> I think you missed the point.

You take this too serious. Didnt you see the smiley?


> Lots of code in ReactOS uses gotos in the way I described before.  As 
> all beginning programming students are taught, gotos are evil, but 
> sometimes they are the lesser evil.  This type of error handling in C is 
> a time when CAREFUL use of gotos is less evil than the alternative.  It 
> avoids duplicating cleanup code while remaining clear and concise, which 
> is why it is an industry standard practice.  If you search you can find 
> plenty of code out there that uses it, and plenty of best practices 
> material that advises it.

SOME functions does, but i can probably count them on one hand (you 
wrote those?). To beeing an industri standard as you claim it surely 
hasnt cought on.


First, Im not forcing the RETURN macros on anyone (I am trying to force 
the list macros, but its for your own good;-P) I applied those RETURN 
macros in win32k as a part of a locking rewrite and until i myself 
presented them as an alternative to gotos, I havent heard a damn thing 
about it.

Again, here are the benefits with RETURN:
1) easy to use. looks like regular return but different enough to make 
people understand they are different;-P
2) much easier to read and spot exit points compared to gotos that jump 
to various return labels (done, error, cleanup, exit, cleanup2, cleanup3 
etc) mixed with "regular" gotos.
3) syntax highlight RETURN and you see a whole new world.
4) a proposed standard way of doing cleanup. not dozens of different 
goto labels (done, error, cleanup, exit, cleanup2, cleanup3 etc).


More information about the Ros-dev mailing list