is there any word processing software for the pdp11?
Roe Peterson
roeapeterson at gmail.com
Tue Dec 2 13:03:56 CST 2014
> On Dec 2, 2014, at 11:08 AM, Jon Elson <elson at pico-systems.com> wrote:
> still discovering new ways that
> C code that looks perfectly correct can screw up horribly. Last one was
> yesterday.
>
> Boiling it down, we had :
>
> long long int A;
> int B;
> A = B << 32;
>
> This means that some field of B gets shifted to the right by 32 bits, and
> fit into the upper 32-bits of A.
>
> Now, any decent compiler should either extend B to the length of A, or
> as the C rules specify, NOT extend B, and therefor ought to warn you
> that it is losing significant bits. No warning, no extending the variable
> before shifting the bits off the end of the word. So, A always gets
> a zero! UGH! Stupid! I could almost write a book of these sorts
> of gotchas.
Hmm. What C compiler did this, on what distro? I'm pretty sure that this throws a compiler warning in gcc with -Wall...
>
> Jon
More information about the cctalk
mailing list