brian@uwvax.UUCP (Brian Pinkerton) (01/07/85)
The C++ description in the latest BLTJ describes the input and output
primitives as being '<<' and '>>'.
What's to become of writing '1<<31' instead of the more readable (:-))
'4294967296'?
brian
--
Brian Pinkerton @ wisconsin
...!{allegra,heurikon,ihnp4,seismo,sfwin,ucbvax,uwm-evax}!uwvax!brian
brian@wisc-rsch.arpamjs@alice.UUCP (M.J.Shannon,Jr.) (01/07/85)
The anomaly you describe (`1<<31') is not anomalous because the
interpretation of each operator is dependent on the types of its
arguments. Further, the use of `<<' for input and `>>' for output are
not a part of the C++ language, but are part of a (the) subroutine
library which requires a header file to be included (to define the
overloading of the operators `<<' and `>>'). Thus, no anomaly.
--
Marty Shannon
UUCP: {alice,research}!mjs
(rabbit is dead; long live alice!)
Phone: 201-582-3199jss@sftri.UUCP (J.S.Schwarz) (01/07/85)
> The C++ description in the latest BLTJ describes the input and output > primitives as being '<<' and '>>'. > > What's to become of writing '1<<31' instead of the more readable (:-)) > '4294967296'? > > Brian Pinkerton @ wisconsin One of the most powerful features of C++ is the ability to overload operators. This means you can add new uses without lossing old one. << and >> still mean shifts when both operands are integers. Jerry Schwarz Bell Labs, Summit N. J.