Mouse wrote in
<202210152055.qaa24...@stone.rodents-montreal.org>:
|> Traditionally to avoid problems with repeated inclusion of a header
|> file, you put #include guards around it, say in sys/dev/foo.h:
|> [...]
|
|> With newer compilers this can be replaced by a single line in the
|> heade
On Sun, Oct 16, 2022 at 06:31:55AM +1100, matthew green wrote:
> note that it is already used in libpcap, bind, libuv, and as a
> test for xlint, in our tree, for consumed components.
hmm?
% grep 'pragma.*once' /usr/include/**.h
%
also, while it does appear (once) inside libuv, that's within
it seems that pcc is missing '#pragma once' support. at least,
the version in src.
ragge, can you fix it? :-) thanks.
.mrg.
On Sat, Oct 15, 2022 at 07:21:35PM +, Taylor R Campbell wrote:
> [bcc tech-userlevel tech-toolchain, followups on tech-kern]
>
> Traditionally to avoid problems with repeated inclusion of a header
> file, you put #include guards around it, say in sys/dev/foo.h:
>
> #ifndef _SYS_DEV
> Traditionally to avoid problems with repeated inclusion of a header
> file, you put #include guards around it, say in sys/dev/foo.h:
> [...]
> With newer compilers this can be replaced by a single line in the
> header file:
> #pragma once
Some newer compilers, perhaps. Unless and until it is
On Sun, 16 Oct 2022, matthew green wrote:
i am a fan of #pragma once. the main reason is that it avoids
the class of bugs where you copy a header and forget to change
the #define and then sometimes the header is empty upon use,
and you end up having to use cpp output to debug it.
I've been bi
i am a fan of #pragma once. the main reason is that it avoids
the class of bugs where you copy a header and forget to change
the #define and then sometimes the header is empty upon use,
and you end up having to use cpp output to debug it.
i'd be ok with using it anywhere -- AFAIK the compiler sup
[bcc tech-userlevel tech-toolchain, followups on tech-kern]
Traditionally to avoid problems with repeated inclusion of a header
file, you put #include guards around it, say in sys/dev/foo.h:
#ifndef _SYS_DEV_FOO_H_
#define _SYS_DEV_FOO_H_
...
#endif /* _SYS_DEV_FOO_H_ */
With newer compilers