Declaring array. Is this ok ?

Karl Heuer karl at ima.isc.com
Wed Nov 14 12:35:49 AEST 1990


In article <APS.90Nov12074527 at kaarne.tut.fi> aps at tut.fi (Suntioinen Ari) writes:
>Gcc seems to accept both.

The default configuration of gcc includes several extensions over ANSI C.
Use "gcc -ansi -pedantic" to test this sort of thing.
	$ cat try.c
	int foo(int n) { int a[n]; }
	$ gcc -c try.c
	$ gcc -ansi -pedantic -c try.c
	try.c: In function foo:
	try.c:1: warning: ANSI C forbids variable-size array `a'
	$ exit

Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list