Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to #define two words to some expression, not just a single word?

If I want to replace all occurrences of byte with unsigned char, a simple #define will do it. Is there any way to do the reverse with a #define? Grouping two words with either single or double quotes doesn't work, nor escaping the space between them with a backslash. Is it even possible?

like image 666
omatai Avatar asked Jul 28 '14 04:07

omatai


People also ask

Will it be possible or is it possible?

The difference between "Is it possible" and "Will it be possible" is that the first question is about the present and the second question is about the future. When we ask "will it be possible" we are referencing a point in time in the future.

Would it be possible means?

spokenASK FOR something/ASK somebody TO DO something used when asking politely if you can do or have something Would it be possible to speak to Oliver?

Is that even possible meaning?

It means "How is that possible?" with a little more emphasis since "even" is included. If it is still not clear, I can try to explain better.

What does it mean when someone says it's possible?

adjective [v-link ADJ] If you say that it is possible that something is true or correct, you mean that although you do not know whether it is true or correct, you accept that it might be.


1 Answers

The identifier in a #define statement cannot contain spaces, at least in C.

The controlling part of the C11 standard (though this is essentially the same in earlier iterations) is 6.10.3 Macro replacement /9-10 (combined below):

A preprocessing directive of the form

# define identifier replacement-list new-line
# define identifier lparen identifier-listopt ) replacement-list new-line
# define identifier lparen ... ) replacement-list new-line
# define identifier lparen identifier-list , ... ) replacement-list new-line

blah blah blah ...

An identifier (as used in those directives) is specified in 6.4.2 of the same standard and does not list the space character as one of the allowed ones.

like image 66
paxdiablo Avatar answered Sep 28 '22 03:09

paxdiablo