3 ms·
It's an interesting approach, but seems far more complex than just generating a random string via a program in the Makefile and importing it into the code as a
by joosters 11y ago
It's an interesting approach, but seems far more complex than just generating a random string via a program in the Makefile and importing it into the code as a #define ... this way would allow you complete freedom to pick the random number in any way that you liked.
A simple method would be something like:
RANDOM := $(shell openssl rand -hex 8)
- iofj 11y agoYeah this is one of those C++ template tricks where one wonders if it's really worth it doing it in C++. Also the purpose seems to be to mark every build as unique. You'd want to store that number somewhere, or it wouldn't be very useful at all. You know, some small database with <who compiled>,<when>,<machine>,<commandline>,<version> and maybe even a diff compared to a known revision number. To really make it useful. That ... just wouldn't be doable in C++.
- jjuhl 11y agoIt would be doable, sure. It just might not be the most efficient solution. ;-)
- anon4 11y agoI'm starting to wonder when someone will write a c++ compiler in c++ templates, in effect making a program whose source code includes its own compiler. I mean, not like gcc, which is written in C and compiled by itself, I mean a program requiring only a c++ template interpreter with none of the other stages.