bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH 04/21] stdint: typedef gl_intptr_t and gl_uintptr_t correctly


From: Paul Eggert
Subject: Re: [PATCH 04/21] stdint: typedef gl_intptr_t and gl_uintptr_t correctly on OS/2 kLIBC
Date: Sun, 30 Nov 2014 09:06:57 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

KO Myung-Hun wrote:
+#ifndef __KLIBC__
  typedef long int gl_intptr_t;
  typedef unsigned long int gl_uintptr_t;
+#else
+typedef int gl_intptr_t;
+typedef unsigned int gl_uintptr_t;
+#endif

This looks brittle.

First, why is it used at all? That is, what's wrong with kLIBC's stdint.h, which causes gnulib to replace stdint.h?

Second, since kLIBC has its own intptr_t etc., I expect it'll be better to use kLIBC's version rather than guess what it will be in future versions. How about something like this instead?

/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
   definitions of intptr_t and uintptr_t (which use int and unsigned)
   to avoid clashes with declarations of system functions like sbrk.  */
#ifndef _INTPTR_T_DECLARED
# undef intptr_t
# undef uintptr_t
typedef long int gl_intptr_t;
typedef unsigned long int gl_uintptr_t;
# define intptr_t gl_intptr_t
# define uintptr_t gl_uintptr_t
#endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]