The ISO C standard doesn't describe any preprocessing directive which assigns the same replacement sequence to multiple symbols. I.e. this sort of thing doesn't exist in the standard:
// fantasy syntax:
#definemulti (A B C) replacement token sequence
Since replacement sequences can contain multiple tokens, there would have to either have to be parentheses somewhere, or some other way to tell where the names end and the replacement sequence.
In 28 years of C coding, I haven't seen any fragment of code anywhere which required a compiler with such an extension.Even if you find a compiler which has this as an extension, the nonportability of using it is hardly worth it.
Introducing this into the language would probably face hurdles because it saves only a small amount of typing.
Moreover, we can make a technical argument that this is a misfeature.
Say we have several compile-time parameters—A
, B
, and C
—for adjusting the behavior of the code. They happen to have the same value, so we define them in one line.
If later they no longer have the same value, the program has to be edited to split off the different values into separate #define
constructs. For instance from this:
#definemulti (A B C) 1
to this
#definemulti (A C) 1
#define B 2
this leads to a line diff which touches A
and C
. The entire definemulti
line is replaced with a new one because B
migrated out of it. Under a GNU-style context diff, the change might resemble the following:
@@ -x, y +z, w @@
...
-#define (A B C) 1
+#define (A C) 1
+#define B 2
...
Whereas if, in the first place, we have:
#define A 1
#define B 1
#define C 1
the diff hunk is nicer, like this:
@@ -x, y +z, w @@
...
#define A 1
-#define B 1
+#define B 2
#define C 1
...
At a glance, we see that A
and C
are unaffected, and that B
changed to 2
.
We should also consider why we have assignment expressions in of the form lval0 = lval1 = lval2 = ... = val
. One big reason is that val
is evaluated only once. The expression a = b = c
cannot always be rewritten as a = c, b = c
due to the change in evaluation order, and multiple evaluation of c
.