Declarations in switches, errors

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Sep 28 14:42:42 AEST 1989


In article <1202 at virtech.UUCP>, cpcahil at virtech.UUCP (Conor P. Cahill) writes:
> If this is the standard, I think it is broken.  If the compiler allows 
> a variable declaration, it should allow an initialization.

If I recall correctly (my copy of the Standard is not at hand), you can
specify the initializer but of course it won't be executed.  Consider
the following analogous case (which does NOT involve "switch") to see why:

	goto label;
	{
		int i = 4;
		foo();
	label:	bar();
		baz();
	}



More information about the Comp.std.c mailing list