www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compiler signature

If I look at the binary created with Borland C++, I can see that it was 
created with Borland C++. It's written there as a string in the ".exe" 
file. If I look at a binary made with gcc (on linux, at least) I see 
strings about libraries, even in a stripped executable.


I wish DMD would include the string DMD and the version number in all 
executables. One might also consider having the date there, and maybe 
the used switches.

This would be immensely useful for all those of us who don't have a 
meticulous secretary, bookkeeping all the files we've ever compiled, and 
with which version, etc. Also the compilation date tends to get 
clobbered because files get copied in various stupid ways during their 
lifetime.

Case in point: I've written programs for some clients, and I may need to 
tweak them much later. Of course, I could even write in the source code 
which compiler version is needed, but that tends to be unreliable. And 
it is quite hard to remember after 3 years which compiler version I had 
in use at the time.

I could also archive every app source with the pertinent dmd.zip, but 
that becomes a lot of megabytes pretty quickly.

Considering the size difference of the stripped binaries of

     // this program works both as D and C with no changes
     int main(){
         return 57;
     }

compiled with my (oldish, admittedly) DMD and gcc, I see no reason why 
not use a couple of extra bytes with some basic info in the binary!!!

$ ls -l c2 d2
-rwxrwxr-x  1 georg georg   2812 Mar 18 16:32 c2
-rwxrwxr-x  1 georg georg 149936 Mar 18 16:33 d2


PS:
It might even work as a kind of advertising. ;-)
Mar 24 2008