mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Using intptr_t and uintptr_t in Kernel
@ 2009-10-13  7:37 Leonidas .
  2009-10-13  8:49 ` Mikael Pettersson
  0 siblings, 1 reply; 4+ messages in thread
From: Leonidas . @ 2009-10-13  7:37 UTC (permalink / raw)
  To: linux-kernel

Hello List,

I know variants of this questions have been asked on this list before,
but I could not
find a thread where a conclusion was reached, most of the time
responses were { I don't care,
developer's choice, might be in future } and variations thereof. But
one thing was clear
that do not mix userspace and kernel space data types.

Currently, I am porting a user space application to kernel, this app
uses intptr_t data type.

A look at linux/types.h shows that,

typedef unsigned long           uintptr_t;

but intptr_t is not defined at all. Also, isn't above definition
incorrect? Since the whole idea
behind uintptr_t is to store pointer in a int sized variable, are we
not assuming here that

sizeof(int) = sizeof(unsigned long ) on all archs? I have not worked
on all archs on which Linux
runs, but if that is the case then above definition is correct.

After looking at stdint.h (which is not available for kernel),

typedef __s32 intptr_t;
typedef __u32 uintptr_t;

sounds more appropriate. Please CMIIW.

-Leo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-13 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13  7:37 Using intptr_t and uintptr_t in Kernel Leonidas .
2009-10-13  8:49 ` Mikael Pettersson
2009-10-13  8:58   ` Leonidas .
2009-10-13 11:47     ` Mikael Pettersson

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®