[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Portable Code (am I dreaming? :))
From:       Nicolas Goutte <nicog () snafu ! de>
Date:       2002-01-24 12:36:26
[Download RAW message or body]

On Thursday 24 January 2002 12:35, Clarence Dang wrote:
> On Thu, 24 Jan 2002 08:53, shaheed wrote:
> > Nicolas,
> >
> > > > 1. Write all your code in terms of Q_{U,}INT{8,16,32} to maximise
> > > > portability on all Qt supported platforms. In your header file, do
> > > > something like this:
> > > >
> > > > #ifndef Q_UINT8
> > > >
> > > > ...as many platform-specific defs enclose in platform #ifdef guards
> > > >
> > > > #endif
> > > >
> > > > to maximise portability on non Qt supported platforms. Or vice versa.
> > >
> > > I do not think that you need it.
> > >
> > > The MS Write import filter does define its base types (BYTE, WORD,
> > > DWORD...) correctly (apart perhaps from the comment I made about
> > > signess).
> >
> > No, the mswrite filter does it *wrong* for DWORD on any modern 64 bit
> > machine. Basically, most 32 bit machines (e.g. "modern" x86) uses the
> > so-called "ILP32" model where Integers Longs and Pointers are all 32 bit.
> > However, AFAIK, all the major 64 bit platforms use "LP64" (once you get
> > over the crappy transitional compiler environments that certain Unixes
> > used to "help" application porters migrate) so that where mswritelib.h
> > says:
> >
> > typedef signed long DWORD;                      // 4 bytes
> >
> > it will break on Digital UNIX, Solaris 8 and Irix in their 64 bit clean
> > compilation environments. Note that these have always been, or are
> > becoming, the defaults for those platforms. I suspect, but don't have
> > proof, that Qt is more likely to get this right on a range of platforms
> > than me, for example
> >
> > :-), and I was taking the liberty of extrapolating to others too!
>
> I thought that in a 16-bit environment, int=short (16 bits) and
> in a 32-bit environment, int=long (32bits).  This is purely from
> observation however. How big are short and long in 64bit?

short = 16 bits
long = 64 bits

And if I have well understood, int (without short or long) is 32 bits wide. 
(Shaheed could surely confirm or deny.)

>
> Thanks!
> Clarence

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic