Re: ObjC enhancements? (was: Major Bug in Cocoa (With sample Code!!))
Re: ObjC enhancements? (was: Major Bug in Cocoa (With sample Code!!))
- Subject: Re: ObjC enhancements? (was: Major Bug in Cocoa (With sample Code!!))
- From: Andreas Monitzer <email@hidden>
- Date: Sun, 5 Aug 2001 04:16:32 +0200
On Sunday, August 5, 2001, at 03:28 , Ondra Cada wrote:
It would be quite nice if one C++ bug can be corrected. The C++ does not
allow goto (or "hidden" gotos like switch etc) with initialization, not
even
in cases when it is perfectly proper, like:
if (?) goto Lbl;
int i=1;
...
Lbl:
// below this point i is *never* used
I seriously vote for making every goto a compiler warning. Your code
example above could easily be written as
if(!?) {
int i=1;
...
}
which even handles int i; fine (even in the current implementation) and
isn't confusing to somebody else reading that source.
I'm currently working on a codebase someone else wrote featuring 'goto's
all over the place, it's confusing as hell. It's fine in Assembler and
BASIC, but C isn't suited for that programming style.
even
10 IF ? THEN 40
20 LET I=1
30 ...
40
is easier to read than that.
andy
--
Discussion forthcoming.