Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933796AbZJMIuE (ORCPT ); Tue, 13 Oct 2009 04:50:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751668AbZJMIuD (ORCPT ); Tue, 13 Oct 2009 04:50:03 -0400 Received: from fanny.its.uu.se ([130.238.4.241]:2256 "EHLO fanny.its.uu.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbZJMIuB (ORCPT ); Tue, 13 Oct 2009 04:50:01 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19156.16146.326389.380625@pilspetsen.it.uu.se> Date: Tue, 13 Oct 2009 10:49:22 +0200 From: Mikael Pettersson To: "Leonidas ." Cc: linux-kernel Subject: Re: Using intptr_t and uintptr_t in Kernel In-Reply-To: References: X-Mailer: VM 7.17 under Emacs 20.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1292 Lines: 39 Leonidas . writes: > 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? 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/