Re: 2.4.19pre8aa1 & vm-34: zftape-init.c compile error

Eyal Lebedinsky (eyal@eyal.emu.id.au)
Sun, 05 May 2002 17:33:32 +1000


Mike Fedyk wrote:
>
> On Sat, May 04, 2002 at 10:18:13AM +1000, Eyal Lebedinsky wrote:
> > Andrea Arcangeli wrote:
> > >
> > > Full patchkit:
> > > http://www.us.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.19pre8aa1.gz
> >
> > linux-2.4-pre-aa/drivers/char/ftape/zftape/zftape-init.c fails to build,
> > a declaration is put in an illegal place.
> >
>
> Why is it illegal to put that before the ifdef instead of after?

In standard C, declarations must precede statements in a block. When the
#if is true, the declaration is exposed, and it is after an assignment,
a syntax error.

The most general solution is to always open a new block if you need a
declaration, but here the code fragment is small enough to not do so
(but one needs to be alert).

#if ...
{
int x;
x = ...
}
#endif

--
Eyal Lebedinsky (eyal@eyal.emu.id.au) <http://samba.org/eyal/>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/