lkml.org 
[lkml]   [2002]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.4.19pre8aa1 & vm-34: zftape-init.c compile error
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/

\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.038 / U:2.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site