Numeric constants as strings
- From
- Andy Parkins <andyparkins@gmail.com>
- Date
- Feb 19, 2007, 09:16 UTC
- Message-ID
- <200702190916.35813.andyparkins@gmail.com>
Hello,
I'm working on bringing my hash width literals patch up to date now that 1.5.0 has passed. It's all been trivial apart from one line:
#define HASH_WIDTH_ASCII 40
- printf("%-40s %s%s (%d subtrees)\n",
+ printf("%-" HASH_WIDTH_ASCII "s %s%s (%d subtrees)\n",This compiles, but I suspect that it's not going to do what I want it to do. It's something I've never been able to do in C - how does one get quotes around a defined value? I don't really want to resort to
+ printf("%-*s %s%s (%d subtrees)\n", HASH_WIDTH_ASCII,As that's a runtime change.
Andy
-- Dr Andy Parkins, M Eng (hons), MIEE andyparkins@gmail.com