P99

◆ P99_WEAK

#define P99_WEAK (   ...)    P99_IF_LT(P99_NARG(__VA_ARGS__), 2)(P00_WEAK1(__VA_ARGS__))(P00_WEAK2(__VA_ARGS__))

Declare a symbol to be weak such that it can be provided several times without error.

This should be placed before the corresponding declaration and receive the name of the symbol as an argument. Such as

P99_WEAK(toto)
unsigned toto;

To have maximum portability this should immediately precede the definition. Another form would be

P99_WEAK(func, _func)
unsigned func(void);

By that all references to func would use _func, instead.

Remarks
This feature seems to be widely supported. We have seen it mentioned for gcc and relatives, IBM, SGI, HP, SUN, Diab, Microsoft

Definition at line 561 of file p99_compiler.h.

P99_WEAK
#define P99_WEAK(...)
Declare a symbol to be weak such that it can be provided several times without error.
Definition: p99_compiler.h:561