This question is in response to What is &&& operation in C which got me thinking about & being used both as binary AND and address-of.
Why is the same symbol used for both these very dissimilar tasks? When thinking about it, @ would seem to be a better symbol for address-of.
I don’t expect it to cause much problem in practice since the compiler will probably catch most faulty use, but it would probably be possible to create code involving macros that looks like it is doing a binary AND while it is actually doing address-of.
The reason
@was not used for “address of” (as you suggested would be a good choice) is that that character was not part of the ISO 646 character set, which was actually used back in the early days of C.While it is true that the designers of C could have used
@and designed a trigraph sequence for it, I suspect they felt it was not really worth the hassle. The fact that&&&can appear in people’s code was probably not considered reason enough to choose a different operator symbol.