[sclug] GCC extensions
Alex Butcher
lug at assursys.co.uk
Thu Oct 27 11:44:43 UTC 2005
Useful reference:
<http://rlove.org/log/2005102601>
Sample:
" __must_check int f (void) { ... }
This attribute instructs GCC to generate a warning whenever the return value
from the function is not stored or used in an expression during invocation.
This allows functions whose return value is crucial to ensure that the value
is always used.
__deprecated void f (void) { ... }
This attribute instructs GCC to generate a warning, at the call site,
whenever the function is used. This helps developers wean off of deprecated
interfaces."
Robert also suggests using a header file which defines away the extensions
if the compiler isn't GCC, or is too old to provide the extensions, thereby
making code which uses them (more) portable.
Alex.
--
Alex Butcher Brainbench MVP for Internet Security: www.brainbench.com
Bristol, UK Need reliable and secure network systems?
PGP/GnuPG ID:0x271fd950 <http://www.assursys.com/>
More information about the Sclug
mailing list