From: Mikael Pettersson <mikpe@it.uu.se>
To: "Leonidas ." <leonidas137@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Using intptr_t and uintptr_t in Kernel
Date: Tue, 13 Oct 2009 13:47:06 +0200 [thread overview]
Message-ID: <19156.26810.772413.603275@pilspetsen.it.uu.se> (raw)
In-Reply-To: <f22d86810910130158u73c2f669wa129fa4e8d48b521@mail.gmail.com>
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.
prev parent reply other threads:[~2009-10-13 11:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-13 7:37 Leonidas .
2009-10-13 8:49 ` Mikael Pettersson
2009-10-13 8:58 ` Leonidas .
2009-10-13 11:47 ` Mikael Pettersson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19156.26810.772413.603275@pilspetsen.it.uu.se \
--to=mikpe@it.uu.se \
--cc=leonidas137@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®