views:

109

answers:

2

I'm fairly new to the C preprocessor. Is it possible to change the case of an argument provided to a function-like #define? For example, I want to write test(size) and then involve "Size" in the resulting replacement.

A: 

Yes. Have you tried it?

guidj0s
Have you? Examples please.
Mark Hurd
+2  A: 

No. The preprocessor can combine identifiers to form new ones, but it cannot modify an identifier.

James McNellis
So, to do this--I probably won't now :(--I'd need to use something more like `test(s,S,ize)` (eww)?
andyvn22
@andyvn: You could do it that way; note that the first parameter is unneeded. There's not much point in doing that, of course, since you have to give it the capital letter ;-).
James McNellis
@andyvn22 - or you can do something like `test(size, Size)` - it's more redundant but has less of an eww fact (at least to me).
R Samuel Klatchko
`test(size,Size)` it is. I'm not happy about it, though. :P
andyvn22