In C++, we can write and
for &&
, or
for ||
, bitand
for &
and bitor
for |
.
Now I wonder whether and
and bitand
are only valid where those operators are meant, or also where references are defined (g++ 4.6.3 accepts bitand
for references — rvalue references seem not to be supported in that version — but of course that might just be the compiler not catching the error).
In short: Is the following code valid C++?
int and x = 3;
int a;
int bitand y = a;
Of course I would never write such code (except maybe if participating in an obfuscated code contest), but is it actually valid?
to take the place of something, or to put something or someone in the place of something or someone else: The factory replaced most of its workers with robots.
Some common synonyms of replace are displace, supersede, and supplant.
Example SentencesPaper bags have been largely replaced by plastic bags. She was hired to replace the previous manager. I replaced the old rug with a new one.
According to C++11, 2.6/4:
In all respects of the language, each alternative token behaves the same, respectively, as its primary token
So int and a = 5;
is perfectly valid, though also perfectly insane.
More examples:
struct ete
{
compl ete();
int egr()and;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With