Angel Tsankov wrote:
Can someone recommend a way to create "unique" identifiers for use
in guard macros:
#if !defined (UNIQUE_GUARD)
#define UNIQUE_GUARD
As you said, the most important thing is to not collide with any existing
one. The advise to use a GUID is a good one, another good one is to just
use the date when the file is started. I always leave a generic prefix
like the module and the filename in uppercase (just in case I need to
identify where it's coming from).
BTW: you asked for a GUID tool - depending on the system you have, you
don't need one, on most unixoid systems you can do this:
dd if=/dev/urandom count=1 bs=10 | md5sum
This reads ten bytes from a random-number generator and computes their MD5
hash - should be sufficiently unique. ;)