Re: Windows sizeof(long) != Linux sizeof(long)

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

 



Daniel P. Berrange wrote:
Just discovered that on x86_64,  Windows and Linux differ in what they
think sizeof(long) to be.

  http://lists.xensource.com/archives/html/xen-devel/2008-01/msg00736.html
  http://www.winehq.org/pipermail/wine-devel/2005-July/038602.html

Oh yes. I haven't even tried Windows x86-64 (only 32 bit Windows). I don't think there is even a version of MinGW which is available for it.

Another problem is going to be for all the places that we assume long == sizeof pointer (eg. all the XDR code, written originally for Sun OS 4 on SparcStations). At least gcc warns about this one. Portable XDR library coming up soon.

  Windows i686:    sizeof(long) == 4,  sizeof(void*) == 4
  Windows x86_64:  sizeof(long) == 4,  sizeof(void*) == 8

  Linux i686:    sizeof(long) == 4,  sizeof(void*) == 4
  Linux x86_64:  sizeof(long) == 8,  sizeof(void*) == 8

Unfortunately we have a number of APIs which use 'long' in the public header
file for dealing with VM memory. Fortunately they are all using memory in
size of KB, so we are not totally doomed until people start wanting to manage VMs with > 2 TB of RAM. Also fortunately, the wire-encoding for
these APIs all uses hyper, so on the wire everything is 64-bit guarenteed.
Eventually though we might want to consider adding

This has come up before. _Please_ can we use the definitions in stdint.h! We want integers of a specific size, so let's use integers of a specific size, not just guess about what the size might be.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]