• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ObjC enhancements? (was: Major Bug in Cocoa (With sample Code!!))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: documentation generators for Cocoa/Obj-C?
  • Next by Date: How can I draw into a NSImage instance?
  • Previous by thread: Re: documentation generators for Cocoa/Obj-C?
  • Next by thread: How can I draw into a NSImage instance?
  • Index(es):
    • Date
    • Thread