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.
1 Answer
No. The preprocessor can combine identifiers to form new ones, but it cannot modify an identifier.
4 Comments
andyvn22
So, to do this--I probably won't now :(--I'd need to use something more like
test(s,S,ize) (eww)?James McNellis
@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 ;-).
R Samuel Klatchko
@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).andyvn22
test(size,Size) it is. I'm not happy about it, though. :P