We try and embed a what string within binary objects so that we can see the version number for an executable or shared library that has been deployed. Typically we embed standard CVS Id information in this what string. For example, we might embed:
const char cvsid[] = "@(#)OUR_TEAM_staging_remap_$Revision: 1.30 $ $Name: $";
within the C code.
From man (1) what:
The what utility searches each filename for occurrences of the pattern @(#) that the SCCS get command (see sccs-get(1)) substitutes for the @(#) ID keyword, and prints what follows up to a ", >, NEWLINE, \, or NULL character.
There is only one instance of this variable and it is never referred to. Someone suggested that this might get optimised away by the compiler.
I've been using this technique for many years in both C and C++ and with a variety of compilers and I've yet to see a what string optimised away.
Anyone got an idea why they aren't optimised away?
cheers,
Rob