2010/1/21 Peter Stuge <peter_at_stuge.se>:
> Alexander Lamaison wrote:
>
>> > Cleaning up ptr in the above example is the point. Instead of
>> > duplicating cleanup code in every single error handling branch within
>> > main stuff, all cleanup code is in one single location.
>>
>> This should still be done with a function. Arguably, that's what
>> they were invented for.
>
> I will argue that to no end. What is this about though? goto? The
> point Ken or whoever it was wanted to make is that goto should not be
> used to jump between scopes. What people seem to have interpreted
> that into is that gotos should never be used. I have so far not seen
> a big advantage of backwards gotos in C, so my simplest rule becomes
> that forward gotos are usually if not always OK.
You make a good point here about scope so in the end it boils down to
an issue of style. As such, I remove my objection to using goto for
these cases.
Alex
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-01-22