12

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 1

7

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

Sign up to request clarification or add additional context in comments.

4 Comments

So, to do this--I probably won't now :(--I'd need to use something more like test(s,S,ize) (eww)?
@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 ;-).
@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).
test(size,Size) it is. I'm not happy about it, though. :P

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.