[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <19156.26810.772413.603275@pilspetsen.it.uu.se>
Date: Tue, 13 Oct 2009 13:47:06 +0200
From: Mikael Pettersson <mikpe@...uu.se>
To: "Leonidas ." <leonidas137@...il.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Using intptr_t and uintptr_t in Kernel
Leonidas . writes:
> > > typedef unsigned long uintptr_t;
> > >
> > > but intptr_t is not defined at all. Also, isn't above definition
> > > incorrect?
> >
> > No, it's correct because Linux requires sizeof(void*) == sizeof(long).
> >
> > > Since the whole idea
> > > behind uintptr_t is to store pointer in a int sized variable,
> >
> > uintptr_t will use _some_ integer type, not necessarily 'int'.
> >
> > If ISO C said 'int' there would be no need for {,u}intptr_t.
> >
> > > are we
> > > not assuming here that
> > >
> > > sizeof(int) = sizeof(unsigned long ) on all archs?
> >
> > No, see above.
> >
>
> Thanks, for the response, but frankly I am still confused.
> Let me recollect my thoughts in more concise manner.
>
>
> User space documentation for C99, http://linux.die.net/man/3/intptr_t says,
>
> typedef unsigned int uint16_t
> typedef uint16_t uintptr_t
That's based on what C99 states, but it's not the definition of uintptr_t
but a specification of the minimal size of that type. The page you're
referring to fails to mention that.
Anyway, this is not an issue with the kernel. Please direct C questions
to a C-specific forum, like comp.std.c. Or google n1124.pdf and read that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists