tech-kern archive

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

Re: declarations in switch statements (Re: wedges on vnd(4) patch)



On Tue, Jun 22, 2010 at 09:31:19PM +0000, Christos Zoulas wrote:
> In article <20100622182446.GA3777%nimenees.com@localhost>,
> Eric Haszlakiewicz  <erh%nimenees.com@localhost> wrote:
> >
> >btw, there's a 5th option that is a bit in between:
> >switch (c) {
> >     int myvar;
> >case 'a':
> >     myvar = somevalue;
> >     stmt;
> >}
> >
> >but I wouldn't recommend it b/c variable initialization on the declaration 
> >line
> >happens in a non-obvious way (or rather, it *doesn't* happen).
> 
> And there is no warning at all.

Which makes it a great feature to use in an obfuscated C project! :)

eric


Home | Main Index | Thread Index | Old Index