Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libarch/alpha



On Thu, 22 Mar 2012, Havard Eidnes wrote:
Modified Files:
        src/lib/libarch/alpha: alpha_pci_io.c

Log Message:
Add a cast of the shift count to int32_t, so that we don't try
to do int32_t << long, since ANSI C doesn't perform "balancing"
before the shift operation according to lint.  Should not make a
difference, offset is limited to 0..3 anyway.

I don't know what "balancing" means, but this seems bogus to me. The type of the right hand operand of the << operator is irrelevant; only its value is important. (See sectiopn 6.5.7 of the C99 standard.)

I think it's fine to add casts that are not really nbecessary, if they improve the readability or portability of the code. The cast here does not do that, and I think it should not be added.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index