Declarations in switches, errors

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Sat Sep 30 00:54:31 AEST 1989


I guess my main thought on declarations at the start of a switch is that
anything which is allowed (ie. legal C) should work. It would probably
take less effort to make it work than to add error checking code, from a
compiler standpoint.

It a feature with limited use even if it did work, but I am bothered by
anything I can write which is legal but may not work the same way on all
implementations. Perhaps a little matter for the next committee would be
to either say "initialization of variables declared at the start of a
switch is not allowed" or "variables declared at the beginning of a
switch are initialized before the control expression is evaluated, even
if no cases are matched."

I have no strong feelings about whether it should or shouldn't work, but
it should be predictable. That's what standards are all about, right?

-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.std.c mailing list