On Dec 2, 2014, at 2:21 PM, Fred Cisin <cisin at xenosoft.com> wrote:
long long int A;
int B;
A = B << 32;
Hmm. What C compiler did this, on what distro? I'm pretty
sure that
this throws a compiler warning in gcc with -Wall...
WARNING. NOT ERROR.
Right, as I said. So long as no syntax or linking issue prevents compilation, I
wouldn't expect the C compiler to error out, but (if requested) generate a warning.
C does not attempt to prevent programmer bungling, just programmer impossibility :-)
I always advised my students to turn up warnings to
the max, but many
didn't want to.
Back in the day, many beginning programmers (like me) poopooed lint, too, despite the 10
rules of computer programming cf. Henry Spencer.
And, are you aware of what some intel chips will do if you ask them to
shift 33 bits? (anything >32)
No, but I imagine it could be spectacular. The history of computing has a bunch of
stories regarding grim results when trying to execute impossible or unimplemented
instructions.