pragma ident

From Cppwiki

Jump to: navigation, search
WARNING: Non-Standard Feature This section includes information about a non-standard language extension

#pragma ident is a non-standard pragma, supported by most Unix compilers, which adds an identification string to the compiled object. #pragma ident is typically used to include version information for source files (e.g. a version control identifier).

When combined with @(#), these strings can be extracted from an object or executable with the what command.

Example:

 #pragma ident "%W% %E% %U%" /* typical SCCS id string; %W% expands to @(#) followed by filename */

Some operating systems (such as 4BSD-derived Unixes) support the __RCSID macro, defined in <sys/cdefs.h>, with a similar purpose (typically implemented as a static const char*).

Compilers supporting #pragma ident:

Personal tools