Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Aug 1997 11:45:58 -0700
From:      Sean Eric Fagan <sef@Kithrup.COM>
To:        chat@freebsd.org
Subject:   Re: variable sized arrays and gcc
Message-ID:  <199708101845.LAA21530@kithrup.com>

next in thread | raw e-mail | index | archive | help
>> The feature will now make it into the next ANSI C version.  (Along with a
>> bunch of stuff that is *WRONG* and *EVIL*.  But this particular feature I
>> happen to like.)
>Like what?

The one I particularly hate, which distresses me greatly, is the C++-ish
ability to declare a variable anywhere.  E.g.,

	foo() {
		int i;
		printf ("i = %d\n", i);
		int j;
		printf ("j = %d, i still = %d\n", j, i);
	}

This is useful in exactly one situation that I can think of:

	for (int i = 0; i < 100; i++) {
		printf ("i = %d\n", i);
	}

but even that has complications.  (How do you declare multiple variables of
different types?)

It's not as if any existing code truly uses this -- the only code that has
this is C++, and C++ is not C.  It adds very little to the language, except
for an ability to have even more badly written code, and will make some
compilers a bit harder to write (but that's balanced by making others a bit
easier to write).

It's ugly.  Yuck.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708101845.LAA21530>