We try and embed a string within the binary object so that we can get an executable or version number We were deployed, usually we embed standard CVS ID information in this string. For example, we can embed:
const char cvsid [] = "@ (#) OUR_TEAM_staging_remap_ $ revision: $ 1.30 $ $ name: $";
Inside the C code
What is man (1) from:
What utility searches for events in each file name pattern @ (#) that SCCS has the @ (#) ID Option for the keyword (see sccs-get (1)) option, and print, which follows the ",>, Newline, \, or NULL character.
This variable only There is an example and it is never called. Somebody has suggested that it can be optimized by the compiler.
I have been using this technique for many years With both C and C ++ in both and with various compilers and I have not yet optimized a string.
Has anyone ever realized why they have not been removed?
Cheers,
Rob
So far Problem was seen in the middle of 2005), it was possible to use:
Static Constance SCC [] = "@ (#)% W %% e%";
or source code and some more in GCC R. Compiler will not be able to remove it. About that time, GCC starts with GSC release from GCC (GCC 4.0.x, which starts from April 2005), those constant strings are excluded from binary. I went. Therefore, I had to go out to modify my source code to make it outwardly visible It is not possible to see the compiler object file alone and to conclude that the string is not used because something outside the file probably can not reference it. Therefore, my files are now included:
#ifndef lint extern const char jlss_id_filename_c []; Const char jlss_id_filename_c [] = "@ (#) $ id $"; #endif/ * lint * /
OK - this is a hybrid; I actually use RCS to store the source code, but I still prefer the what
to ident
to identify the file - plus I have my own Has done hacking of what
what both
and ident
both of its own tweaks but I have a declaration in some files - all No - and definition in all the files (under some set of warning flag, do not remember now, warn me The variable was defined when it was defined before the declaration of the variable. This can be a change in the GCC which resolves the problem; I am no longer sure.)
When I If I create a new file, then my template replaces 'filename_c' with the proper name of the generator file. Similarly for header - Although the identity string is embedded in only one file to avoid multiple definitions.
I like the old system with stable constants - but it works for me more than 3 years.
Comments
Post a Comment