Re: Casting between 64bit and 32bit




Wed, Dec 28, 2005 at 10:36:40, js (John Smith) wrote about "Casting between 64bit and 32bit":

JS> To my surprise it turned out unsigned long is 64 bit under linux x86_64
JS> where I assumed it was 32 bit as Windows. I guess 64 bit Windows and Linux
JS> does not use the same 64 bit model. This caused lots of problem which needed
JS> to be fixed.

Yes, difference between Unix (most flavors) and MS Windows on x86-64
(a.k.a. amd64) in type sizes is that Windows has 32-bit long, but
Unix has 64-bit long.

To justify each of this decision one can say Windows tried to keep
maximal compatibility with existing applications, OTOH Unixes has
long tradition to use 64-bit systems and types were aligned to
values the same as for other 64-bit systems (Alpha, Power, Sparc64).
This isn't the only difference; most ABI details differ.

If you want to use fixed-width types for all platforms, use
[u]int32_t and [u]int64_t required by C99.


-netch-
.



Relevant Pages

  • Re: The Problems With Linux
    ... > Here are the problems with Linux: ... programmers of UNIX, Open Source software, and Shareware. ... programs only available from BSD. ... BSD code is used by Microsoft in it's Windows NT/9x/2K/XP code. ...
    (comp.os.linux)
  • Re: What is a MVP?
    ... I made no claim about my person other than I worked as support for Unix ... Windows is like a platform. ... Do I consider you to be yet another Linux troll?.. ...
    (microsoft.public.windowsxp.general)
  • RE: [Full-Disclosure] CyberInsecurity: The cost of Monopoly
    ... I've used UNIX, ... I've used/use Linux, ... > inefficient operating system - if most other Windows ... This is why I don't run POS operating systems. ...
    (Full-Disclosure)
  • Re: Linux no threat to Microsoft
    ... originally developed for Unix. ... Windows has't come on any of the machines I've ever purchased. ... Yet over those years Linux Market Share on the desktop has actually ... philosophy of Apple - later adopted by Microsoft. ...
    (comp.os.linux.setup)
  • Re: Where to start?
    ... > - NO knowledge of Linux or Unix ... Get the latest set of Slackware CD's. ... But don't hog tie yourself with the Windows way of doing things. ...
    (comp.os.linux.misc)