From: Andy Parkins Date: Mon, 19 Feb 2007 10:14:21 GMT Subject: Re: Numeric constants as strings Message-ID: <200702191014.23055.andyparkins@gmail.com> In-Reply-To: <7virdy8p25.fsf@assigned-by-dhcp.cox.net> On Monday 2007 February 19 09:38, Junio C Hamano wrote: > > #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. > > Doesn't writing "foo" "bar" (two string literals next to each other) > tell the compiler to concatenate them? It's not a string literal though. It's #define HASH_WIDTH_ASCII 40 rather than #define HASH_WIDTH_ASCII "40" I'm wondering how to turn the first into the second using the preprocessor. Andy -- Dr Andy Parkins, M Eng (hons), MIEE andyparkins@gmail.com