On Aug 13 2013 8:20 AM, John Kasunich wrote: > On Tue, Aug 13, 2013, at 09:21 AM, andy pugh wrote: >> On 13 August 2013 14:07, Michael Büsch <[email protected]> wrote: >> >> > I think you first have to cast to signed 32-bit and then to signed >> 64-bit. >> >> A far as I can see the fix is to cast the delta to signed-32 >> explicitly rather than to "signed long" >> >> The point of the original email was not to pursue the particular bug >> that I have but to address the issue that there being many more >> casts >> to "long" that also might not do the expected thing in a 64-bit >> system >> (where "long" is 64 bits rather than the 32-bits that they probably >> were when the code was written.) >> > > Yeah. Deja vu all over again - same situation as when we (not > emc, but the whole programming world) transitioned from 16 to > 32 bits. > > I think the moral of the story is that types like int and long that > don't explicitly state their size should be avoided like the plague > for any work that involves hardware. And explicitly sized types > such as s32, u16, s64, etc, should have been built into the > language from the start, and treated on an equal footing with > int, long, char, and the rest.
There are a few instances where an int is an int, and a float a float, but for anything that assumes a minimum number of bits, and anything that does bit arithmetic, it is best to use a non ambiguous type. I would suggest that this be defined as an explicit requirement for LinuxCNC-3.0+ and suggested to migrate in that direction from this point on as needed. The question is if you want to require using type-size variables everywhere. I think that might not be such a bad idea. EBo -- ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
