Re: [PATCH][2.6.8-rc1-mm1] drivers/scsi/sg.c gcc341 inlining fix

From: Andrew Morton
Date: Wed Jul 14 2004 - 18:56:16 EST


Jeff Garzik <jgarzik@xxxxxxxxx> wrote:
>
> Andrew Morton wrote:
> > Yeah, but doing:
> >
> > static inline foo(void);
> >
> > bar()
> > {
> > ...
> > foo();
> > }
> >
> > static inline foo(void)
> > {
> > ...
> > }
> >
> > is pretty dumb too. I don't see any harm if this compiler feature/problem
> > pushes us to fix the above in the obvious way.
>
>
> ??? C does not require ordering of function _implementations_, except
> for this gcc brokenness.

Well. Other compilers had that restriction iirc, and it's a pretty natural
thing to do.

> The above example allows one to do what one normally does with
> non-inlines: order code to enhance readability

I always expect to find those little helper functions earlier in the
compilation unit than their callsites. Pascal-style. Plus you don't have
the hassle of keeping the declaration and definition in sync.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/