Re: double include of a header file

Joe (josepha48@yahoo.com)
Wed, 11 Aug 1999 05:29:41 -0700 (PDT)


Thanks, I thought that. Incidentally the double include was
removed from 2.2.11. and there were many updates


> > I am not a C expert so can someone tell me what the
> benifits
> >/ disadvantages of the following lines of code are if there
> are
> >any? The reason I am writning these lists is that I found
> this
> >code in the kernel..
> >
> >#include <asm/irq.h>
> >#include <asm/system.h>
> >#include <asm/irq.h>
>
> There are no benefits. However there are no problems either.
> Most C header files contain preprocessor directives which
> surround the entire header file and protect it against
> multiple
> inclusion. For example:
>
> #ifndef __MYHEADER_H__
> #define __MYHEADER_H__
>
> (Headerfile contents go here)
>
> #endif /* __MY_HEADER_H__ */
>
> The only thing multiple inclusion does in this case is it
> makes
> the kernel code a bit sloppier, but it doesn't affect anything
> so
> long as the headers all have multiple inclusion protection as
> above.
>
> --
> Mike A. Harris Linux advocate GNU
> advocate
> Computer Consultant Open Source
> advocate
>
> Tea, Earl Grey, Hot...
>
>
>

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/