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

Re: [Libvir] Windows sizeof(long) != Linux sizeof(long)

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


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.


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

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