C++ incompatability, was C99: Suggestions for style(9)

Matthew Fleming matthew.fleming at isilon.com
Fri May 1 16:09:13 UTC 2009


[snip exciting discussion on style]

> There are several C99 features used already, e.g. designated
initializers:
>	bla bli = { .blub = "foo", .arr[0] = 42 };
> Do you suggest that this should not be used, because it is
inconsistent 
> with all the other existing compound initialisations?

Regarding this great feature of C99, sadly, it's not C++ compatible.  So
while designated initializers in a C source file are great, in a header
file they will give a compile error if included in e.g. a C++ kernel
module (which otherwise would work fine).

Actually, as a further digression, I was wondering if/when FreeBSD would
add 

#ifdef __cplusplus
extern "C" {
#endif

to sys/sys/*.h and other headers that can be included by a kernel
module.

Thanks,
matthew



More information about the freebsd-hackers mailing list