mailing list of musl libc
 help / color / mirror / code / Atom feed
* sign (in)consistency between architectures
@ 2013-05-01 17:05 Z. Gilboa
  2013-05-01 18:00 ` Szabolcs Nagy
  0 siblings, 1 reply; 10+ messages in thread
From: Z. Gilboa @ 2013-05-01 17:05 UTC (permalink / raw)
  To: musl


[-- Attachment #1.1: Type: text/plain, Size: 1343 bytes --]

Greetings,

The current architecture-specific type definitions 
(arch/*/bits/alltypes.h) seem to entail the following inconsistent 
signed/unsigned types:

type      x86_64        i386
-------------------------------
uid_t     unsigned      signed
gid_t     unsigned      signed
dev_t     unsigned      signed
clock_t   signed        unsigned

For *uid_t* and *gid_t*, the GNU documentation specifies /_unsigned int_://
//http://www.gnu.org/software/libc/manual/html_node/Reading-Persona.html#index-uid_005ft-3309/

For *dev_t*, the specification requires /_an integer type no narrower 
than int//_/: and given the value it is expected to hold (file device 
numbers), making it /_unsigned_/ seems to be the correct choice.
/http://www.gnu.org/software/libc/manual/html_node/Attribute-Meanings.html#index-dev_005ft-1500/

*clock_t* is defined as the value returned by clock(), and the manual 
page states that  "if the processor time used is not available or its 
value cannot be represented, the function returns the value (clock_t) 
-1."  This in turn suggests that clock_t should be a _signed_ type.
/http://www.gnu.org/software/libc/manual/html_node/CPU-Time.html#index-clock_005ft-2607

/As an additional reference, attached is the output generated by 
musl-alltypes (posted on April 18) for the above architectures.
/
/Best regards,
Zvi


[-- Attachment #1.2: Type: text/html, Size: 2262 bytes --]

[-- Attachment #2: musl-alltypes.i386 --]
[-- Type: text/plain, Size: 5875 bytes --]

                    name            	    size	      signed
                    ====            	    ====	      ======
                 wchar_t            	       4	      signed

                  size_t            	       4	    unsigned
                 ssize_t            	       4	      signed
               ptrdiff_t            	       4	      signed

                  wint_t            	       4	      signed
               wctrans_t            	       4	    unsigned
                wctype_t            	       4	    unsigned

                  int8_t            	       1	      signed
                 int16_t            	       2	      signed
                 int32_t            	       4	      signed
                 int64_t            	       8	      signed

                 uint8_t            	       1	    unsigned
                uint16_t            	       2	    unsigned
                uint32_t            	       4	    unsigned
                uint64_t            	       8	    unsigned

              __uint16_t            	       2	    unsigned
              __uint32_t            	       4	    unsigned
              __uint64_t            	       8	    unsigned

             int_fast8_t            	       1	      signed
            int_fast16_t            	       4	      signed
            int_fast32_t            	       4	      signed
            int_fast64_t            	       8	      signed

            uint_fast8_t            	       1	    unsigned
           uint_fast16_t            	       4	    unsigned
           uint_fast32_t            	       4	    unsigned
           uint_fast64_t            	       8	    unsigned

                intptr_t            	       4	      signed
               uintptr_t            	       4	    unsigned

                intmax_t            	       8	      signed
               uintmax_t            	       8	    unsigned

                 float_t            	      12	      signed
                double_t            	      12	      signed

                  time_t            	       4	      signed
              useconds_t            	       4	    unsigned
             suseconds_t            	       4	      signed

                 va_list            	       4	            

                 timeval            	       8	            
                 timeval.tv_sec     	       4	      signed
                 timeval.tv_usec    	       4	      signed

                timespec            	       8	            
                timespec.tv_sec     	       4	      signed
                timespec.tv_nsec    	       4	      signed

                   pid_t            	       4	      signed
                    id_t            	       4	      signed
                   uid_t            	       4	      signed
                   gid_t            	       4	      signed
                   key_t            	       4	      signed

               pthread_t            	       4	            

          pthread_once_t            	       4	      signed
           pthread_key_t            	       4	      signed
      pthread_spinlock_t            	       4	      signed

          pthread_attr_t            	      36	            
          pthread_attr_t.__u.__i[0] 	       4	      signed
          pthread_attr_t.__u.__s[0] 	       4	      signed

     pthread_mutexattr_t            	       4	    unsigned
      pthread_condattr_t            	       4	    unsigned
   pthread_barrierattr_t            	       4	    unsigned

    pthread_rwlockattr_t            	       8	            
    pthread_rwlockattr_t.__attr[0]  	       4	      signed

         pthread_mutex_t            	      24	            
         pthread_mutex_t.__u.__i[0] 	       4	      signed
         pthread_mutex_t.__u.__p[0] 	       4	    unsigned

          pthread_cond_t            	      48	            
          pthread_cond_t.__u.__i[0] 	       4	      signed
          pthread_cond_t.__u.__p[0] 	       4	    unsigned

       pthread_barrier_t            	      20	            
       pthread_barrier_t.__u.__i[0] 	       4	      signed
       pthread_barrier_t.__u.__p[0] 	       4	    unsigned

        pthread_rwlock_t            	      32	            
        pthread_rwlock_t.__u.__i[0] 	       4	      signed
        pthread_rwlock_t.__u.__p[0] 	       4	    unsigned

                   off_t            	       8	      signed
                  mode_t            	       4	    unsigned
                 nlink_t            	       4	    unsigned
                   ino_t            	       8	    unsigned
                   dev_t            	       8	      signed
               blksize_t            	       4	      signed
                blkcnt_t            	       8	      signed
              fsblkcnt_t            	       8	    unsigned
              fsfilcnt_t            	       8	    unsigned

                 timer_t            	       4	    unsigned
               clockid_t            	       4	      signed
                 clock_t            	       4	    unsigned

                sigset_t            	     128	            
                sigset_t.__bits:    	      32	  array-size
                sigset_t.__bits[0]  	       4	      signed

               siginfo_t            	     128	            

               socklen_t            	       4	    unsigned
             sa_family_t            	       2	    unsigned
               in_port_t            	       2	    unsigned
               in_addr_t            	       4	    unsigned

                 in_addr            	       4	            
                 in_addr.s_addr     	       4	      signed

                 nl_item            	       4	      signed

                   iovec            	       8	            
                   iovec.iov_base   	       4	    unsigned
                   iovec.iov_len    	       4	      signed



[-- Attachment #3: musl-alltypes.x86_64 --]
[-- Type: text/plain, Size: 5875 bytes --]

                    name            	    size	      signed
                    ====            	    ====	      ======
                 wchar_t            	       4	      signed

                  size_t            	       8	    unsigned
                 ssize_t            	       8	      signed
               ptrdiff_t            	       8	      signed

                  wint_t            	       4	      signed
               wctrans_t            	       8	    unsigned
                wctype_t            	       8	    unsigned

                  int8_t            	       1	      signed
                 int16_t            	       2	      signed
                 int32_t            	       4	      signed
                 int64_t            	       8	      signed

                 uint8_t            	       1	    unsigned
                uint16_t            	       2	    unsigned
                uint32_t            	       4	    unsigned
                uint64_t            	       8	    unsigned

              __uint16_t            	       2	    unsigned
              __uint32_t            	       4	    unsigned
              __uint64_t            	       8	    unsigned

             int_fast8_t            	       1	      signed
            int_fast16_t            	       4	      signed
            int_fast32_t            	       4	      signed
            int_fast64_t            	       8	      signed

            uint_fast8_t            	       1	    unsigned
           uint_fast16_t            	       4	    unsigned
           uint_fast32_t            	       4	    unsigned
           uint_fast64_t            	       8	    unsigned

                intptr_t            	       8	      signed
               uintptr_t            	       8	    unsigned

                intmax_t            	       8	      signed
               uintmax_t            	       8	    unsigned

                 float_t            	       4	      signed
                double_t            	       8	      signed

                  time_t            	       8	      signed
              useconds_t            	       4	    unsigned
             suseconds_t            	       8	      signed

                 va_list            	      24	            

                 timeval            	      16	            
                 timeval.tv_sec     	       8	      signed
                 timeval.tv_usec    	       8	      signed

                timespec            	      16	            
                timespec.tv_sec     	       8	      signed
                timespec.tv_nsec    	       8	      signed

                   pid_t            	       4	      signed
                    id_t            	       4	      signed
                   uid_t            	       4	    unsigned
                   gid_t            	       4	    unsigned
                   key_t            	       4	      signed

               pthread_t            	       8	            

          pthread_once_t            	       4	      signed
           pthread_key_t            	       4	      signed
      pthread_spinlock_t            	       4	      signed

          pthread_attr_t            	      56	            
          pthread_attr_t.__u.__i[0] 	       4	      signed
          pthread_attr_t.__u.__s[0] 	       8	      signed

     pthread_mutexattr_t            	       4	    unsigned
      pthread_condattr_t            	       4	    unsigned
   pthread_barrierattr_t            	       4	    unsigned

    pthread_rwlockattr_t            	       8	            
    pthread_rwlockattr_t.__attr[0]  	       4	      signed

         pthread_mutex_t            	      40	            
         pthread_mutex_t.__u.__i[0] 	       4	      signed
         pthread_mutex_t.__u.__p[0] 	       8	    unsigned

          pthread_cond_t            	      48	            
          pthread_cond_t.__u.__i[0] 	       4	      signed
          pthread_cond_t.__u.__p[0] 	       8	    unsigned

       pthread_barrier_t            	      32	            
       pthread_barrier_t.__u.__i[0] 	       4	      signed
       pthread_barrier_t.__u.__p[0] 	       8	    unsigned

        pthread_rwlock_t            	      56	            
        pthread_rwlock_t.__u.__i[0] 	       4	      signed
        pthread_rwlock_t.__u.__p[0] 	       8	    unsigned

                   off_t            	       8	      signed
                  mode_t            	       4	    unsigned
                 nlink_t            	       8	    unsigned
                   ino_t            	       8	    unsigned
                   dev_t            	       8	    unsigned
               blksize_t            	       8	      signed
                blkcnt_t            	       8	      signed
              fsblkcnt_t            	       8	    unsigned
              fsfilcnt_t            	       8	    unsigned

                 timer_t            	       8	    unsigned
               clockid_t            	       4	      signed
                 clock_t            	       8	      signed

                sigset_t            	     128	            
                sigset_t.__bits:    	      16	  array-size
                sigset_t.__bits[0]  	       8	      signed

               siginfo_t            	     128	            

               socklen_t            	       4	    unsigned
             sa_family_t            	       2	    unsigned
               in_port_t            	       2	    unsigned
               in_addr_t            	       4	    unsigned

                 in_addr            	       4	            
                 in_addr.s_addr     	       4	      signed

                 nl_item            	       4	      signed

                   iovec            	      16	            
                   iovec.iov_base   	       8	    unsigned
                   iovec.iov_len    	       8	      signed



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

end of thread, other threads:[~2013-05-02 13:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01 17:05 sign (in)consistency between architectures Z. Gilboa
2013-05-01 18:00 ` Szabolcs Nagy
2013-05-01 20:00   ` Rich Felker
2013-05-01 22:41     ` Rich Felker
2013-05-02  1:39       ` Z. Gilboa
2013-05-02  2:47         ` Rich Felker
2013-05-02  8:12           ` Jens Gustedt
2013-05-02 10:13             ` Szabolcs Nagy
2013-05-02 12:12               ` Jens Gustedt
2013-05-02 13:08                 ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).