discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C++?


From: Nicolas Roard
Subject: Re: Objective-C++?
Date: Tue, 08 Apr 2003 15:01:40 +0100

On 2003-04-08 01:02:49 +0000 Chris B. Vetter <chrisv@web4inc.com> wrote:

On Mon, 07 Apr 2003 20:48:32 -0400
David Relson <relson@osagesoftware.com> wrote:
For the most part I dislike C++, but it has one feature I'd really
like to have in Objective-C - the ability to declare variables
_anywhere_ it makes sense (not just at the start of a block).  One
[...]

Though I especially DON'T like that feature, as it makes reading the
source pretty confusing and may lead to sloppy programming, I use it
for debugging - you can do that already in plain ObjC.


Not exactly ... since gcc 3.x supports ansi C99 (which permits effectively
to declare your variable whatever you want), ObjC with a gcc 3.x works
that way. What's very strange (to me) is that it let you declare your variable 
anywhere but in a loop !

Thus, the following is authorized :

void myfunction {
        printf ("test\n");
        int i;
        for (i= 0; i < 42; i++) {
                printf ("%d\n", i);
        }
}

but this :

void myfunction {
        printf ("test\n");
        for (int i= 0; i < 42; i++) {
                printf ("%d\n", i);
        }
}

is not authorized in C99 (and so, not in ObjC either)

--
Nicolas Roard





reply via email to

[Prev in Thread] Current Thread [Next in Thread]