Topic: Inconsistency in naming of alternative tokens
Author: gennaro_prota@yahoo.com (Gennaro Prota)
Date: Tue, 6 Jul 2004 16:35:49 +0000 (UTC) Raw View
On Tue, 29 Jun 2004 21:44:00 +0000 (UTC), kprateek88@yahoo.com
(Prateek R Karandikar) wrote:
>> There's worse. '&' isn't just used for bitwise and; it's also
>> address-of, and reference-to, depending on context.
>
>So probably we should have additional keywords addrof and refto, or
>addr and ref, or something of that sort. Then, the compiler could
>check those, eg
>
>int ref x=a; //legal
>int addr x=a; //illegal
>int bitand x=a; //horrible (and illegal)
Then 'destr' too? ;)
class X {
compl X() {} // illegal?
destr X() {} // ok?
};
One should realize that the bitand, bitor stuff is at a much lower
level than syntactic analysis. It affects recognition of tokens and
preprocessing tokens, which happens logically before you even have a
syntactic "context" in the sense of phase 7.
--
Genny.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: llewelly.at@xmission.dot.com (llewelly)
Date: Tue, 29 Jun 2004 04:49:22 +0000 (UTC) Raw View
kprateek88@yahoo.com (Prateek R Karandikar) writes:
> and && bitand &
> or || bitor |
> xor ^
>
> "and" and "or" are logical, "xor" is bitwise! Why this inconsistency?
> There are logical operators, and there are bitwise operators, so why
> not have consistent prefixes for both :
[snip]
There's worse. '&' isn't just used for bitwise and; it's also
address-of, and reference-to, depending on context.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Tue, 29 Jun 2004 21:44:00 +0000 (UTC) Raw View
> > and && bitand &
> > or || bitor |
> > xor ^
> >
> > "and" and "or" are logical, "xor" is bitwise! Why this inconsistency?
> > There are logical operators, and there are bitwise operators, so why
> > not have consistent prefixes for both :
> [snip]
>
> There's worse. '&' isn't just used for bitwise and; it's also
> address-of, and reference-to, depending on context.
So probably we should have additional keywords addrof and refto, or
addr and ref, or something of that sort. Then, the compiler could
check those, eg
int ref x=a; //legal
int addr x=a; //illegal
int bitand x=a; //horrible (and illegal)
-- --
Abstraction is selective ignorance.
-Andrew Koenig
-- --
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Fri, 25 Jun 2004 05:29:06 +0000 (UTC) Raw View
and && bitand &
or || bitor |
xor ^
"and" and "or" are logical, "xor" is bitwise! Why this inconsistency?
There are logical operators, and there are bitwise operators, so why
not have consistent prefixes for both :
bitand, bitor, bitxor, bitcompl
logand, logor, lognot
and so on for the _eq versions.
-- --
Abstraction is selective ignorance.
-Andrew Koenig
-- --
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]