Re: portability question



On Wed, 17 Dec 2003 15:18:38 -0800 (PST)
Sheldon Simms <wsxyz6294 yahoo com> wrote:

> 
> --- Magnus Bergman <magnus bergman observer net> wrote:
> > I might be wrong here, but doesn't that go against the C standard?
> 
> No it doesn't.
> 
> > Shouldn't long be (at least) 64 bits on a 64-bit platform?
> 
> I agree that it should be.
> 
> > I thought
> > ANSI C guaranteed that a pointer should fit inside a long.
> 
> I'm afraid not. There are two types intptr_t and uintptr_t that
> are guaranteed to be able to contain a void * (no guarantee for
> other pointer types)
> 
> > If that's not
> > the case this might be a huge portability problem then 64-bit
> > platforms become more common.
> 
> Indeed it might. This sort of things has happened repeatedly in
> the past, and no one ever seems to learn.

Would it possibly be a good idea if glib could guarantee these sort of
things? That gint is always the processors word-length and glong is at
least the size of (the biggest) pointer on the platform. It would of
course mean that glong could be different from long, but if I want a
long I could just use an long, right? Am I possibly missing the big
picture here? Would this cause more trouble than it would solve?

Or perhaps new data types (in glib) would make sense since intprt_t
isn't available everywhere (I was told)?

I think these kind of things are important since I find the portability
of glib being its main feature.



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