Reputation: 6555
Imagine this:
#define PUTVALUE 0x000000000000000F
#define SetStr(s) literate(s)
#define literate(s) #s
...
foo (PUTVALUE, SetStr(PUTVALUE));
How can I make work this, where foo
wants as first parameter a 64 bit integer, and as second parameter a const string with a hexadecimal representation of that integer with leading 0x
.
So I cant do:
#define PUTVALUE 0x000000000000000Full
as this would break the second parameter.
But not doing so is breaking the first.
Upvotes: 1
Views: 272
Reputation: 6555
Oh I figgured just out an awesome way to do so:
foo (INT64_C(PUTVALUE), SetStr(PUTVALUE));
Is doing exactly that job.
Upvotes: 1