threads / discuss / 12026

C-compiler features

Subject: C-compiler features

## tl;dr

2 messages between Feb 11, 2008 and Feb 11, 2008.

replies: 1people: 2as markdown or json

H.Merijn Brand· Feb 11, 2008, 08:03 UTC · lore

Having to answer questions about my C-compiler isn't always that easy. Sometimes you need to find include files, for which you don't know if and if how they are used. Sometimes you need to compile test programs to see the behaviour, and then there is threads, 32/64 bitness etc.

I was recently pointed to http://www.math.utah.edu/pub/features/ Which gives a nice summary of what your C/C++ compiler behaves like. Here's the output for HP C-ANSI-C on HP-UX 11.23/64 IPF and on 11.00

======================================================================== HP-UX 11.23/64 U rx1620/64 Itanium 2/1600(2) ia64 2037 Mb B9007AA.C-ANSI-C C.06.15 HP C/aC++ Compiler

Compiler                             = cc
Available standard predefined constant macros...
        __DATE__                     = "Feb 11 2008"
        __FILE__                     = "features.c"
        __LINE__                     =      180
        __STDC__                     =        1
        __STDC_VERSION__             =   199012
        __TIME__                     = "08:50:58"
Missing standard predefined constant macros...
        __bool_true_false_are_defined
        __cplusplus
        __func__
        __STDC_HOSTED__
        __STDC_IEC_559__
        __STDC_IEC_559_COMPLEX__
        __STDC_ISO_10646__
        __STDC_CONSTANT_MACROS
        __STDC_FORMAT_MACROS
        __STDC_LIMIT_MACROS
Available nonstandard but traditional header files...
        <sys/types.h>
        <varargs.h>
Missing nonstandard but traditional header files...
Available 1989 Standard C header files...
        <assert.h>
        <ctype.h>
        <errno.h>
        <float.h>
        <limits.h>
        <locale.h>
        <math.h>
        <setjmp.h>
        <signal.h>
        <stdarg.h>
        <stddef.h>
        <stdio.h>
        <stdlib.h>
        <string.h>
        <time.h>
Missing 1989 Standard C standard header files...
Available additional 1999 Standard C header files...
        <complex.h>
        <fenv.h>
        <inttypes.h>
        <iso646.h>
        <stdbool.h>
        <stdint.h>
        <tgmath.h>
        <wchar.h>
        <wctype.h>
Missing additional 1999 Standard C standard header files...
Available additional POSIX (IEEE Std 1003.1-2001) header files...
        <aio.h>
        <arpa/inet.h>
        <cpio.h>
        <dirent.h>
        <dlfcn.h>
        <fcntl.h>
        <fmtmsg.h>
        <fnmatch.h>
        <ftw.h>
        <glob.h>
        <grp.h>
        <iconv.h>
        <langinfo.h>
        <libgen.h>
        <monetary.h>
        <mqueue.h>
        <ndbm.h>
        <net/if.h>
        <netdb.h>
        <netinet/in.h>
        <netinet/tcp.h>
        <nl_types.h>
        <poll.h>
        <pthread.h>
        <pwd.h>
        <regex.h>
        <sched.h>
        <search.h>
        <semaphore.h>
        <strings.h>
        <stropts.h>
        <sys/ipc.h>
        <sys/mman.h>
        <sys/msg.h>
        <sys/resource.h>
        <sys/select.h>
        <sys/sem.h>
        <sys/shm.h>
        <sys/socket.h>
        <sys/stat.h>
        <sys/statvfs.h>
        <sys/time.h>
        <sys/timeb.h>
        <sys/times.h>
        <sys/types.h>
        <sys/uio.h>
        <sys/un.h>
        <sys/utsname.h>
        <sys/wait.h>
        <syslog.h>
        <tar.h>
        <termios.h>
        <ucontext.h>
        <ulimit.h>
        <unistd.h>
        <utime.h>
        <utmpx.h>
        <wordexp.h>
Missing additional POSIX (IEEE Std 1003.1-2001) header files...
        <spawn.h>
        <trace.h>
Pointer sizes...
        sizeof(char*)                   =    8
        sizeof(void*)                   =    8
        sizeof(void(*)(void))           =    8
Integer sizes...
        sizeof(char)                    =    1
        sizeof(short)                   =    2
        sizeof(int)                     =    4
        sizeof(long)                    =    8
        sizeof(long long)               =    8
Integer-like sizes...
        sizeof(clock_t)                 =    4
        sizeof(div_t)                   =    8
        sizeof(fpos_t)                  =    8
        sizeof(intmax_t)                =    8
        sizeof(ldiv_t)                  =   16
        sizeof(off_t)                   =    8
        sizeof(ptrdiff_t)               =    8
        sizeof(sig_atomic_t)            =    4
        sizeof(size_t)                  =    8
        sizeof(time_t)                  =    8
        sizeof(uintmax_t)               =    8
        sizeof(wchar_t)                 =    4
C++ 1998 integer-like sizes...
C99 integer-like sizes...
        sizeof(double_t)                =    8
        sizeof(fenv_t)                  =    8
        sizeof(fexcept_t)               =    4
        sizeof(float_t)                 =    4
        sizeof(int8_t)                  =    1
        sizeof(int_fast16_t)            =    4
        sizeof(int_fast32_t)            =    4
        sizeof(int_fast64_t)            =    8
        sizeof(int_fast8_t)             =    4
        sizeof(int_least16_t)           =    2
        sizeof(int_least32_t)           =    4
        sizeof(int_least64_t)           =    8
        sizeof(int_least8_t)            =    1
        sizeof(intptr_t)                =    8
        sizeof(ssize_t)                 =    8
        sizeof(uint_fast16_t)           =    4
        sizeof(uint_fast32_t)           =    4
        sizeof(uint_fast64_t)           =    8
        sizeof(uint_fast8_t)            =    4
        sizeof(uint_least16_t)          =    2
        sizeof(uint_least32_t)          =    4
        sizeof(uint_least64_t)          =    8
        sizeof(uint_least8_t)           =    1
        sizeof(uintptr_t)               =    8
        sizeof(wchar_t)                 =    4
        sizeof(wctype_t)                =    4
        sizeof(wint_t)                  =    4
        sizeof(_Bool)                   =    1
Floating-point sizes...
        sizeof(float)                   =    4
        sizeof(double)                  =    8
        sizeof(long double)             =   16
Missing data types...
        imaxdiv_t
        lldiv_t
        mbstate_t
        nothrow_t
        wctrans_t
        _Complex
        _Imaginary
fpathconf() and pathconf() tests...
        pathconf("/", _PC_NAME_MAX)              =   255
        pathconf("/bin", _PC_NAME_MAX)           =   255
        pathconf("/etc", _PC_NAME_MAX)           =   255
        pathconf("/tmp", _PC_NAME_MAX)           =   255
        pathconf("/usr", _PC_NAME_MAX)           =   255
        pathconf("/var", _PC_NAME_MAX)           =   255
        pathconf("./", _PC_NAME_MAX)             =   255
        fpathconf(fileno(stdin),  _PC_NAME_MAX)  =    -1
        fpathconf(fileno(stdout),  _PC_NAME_MAX) =    -1
        fpathconf(fileno(stderr),  _PC_NAME_MAX) =    -1
        pathconf("/", _PC_PATH_MAX)              =  1023
        pathconf("/bin", _PC_PATH_MAX)           =  1023
        pathconf("/etc", _PC_PATH_MAX)           =  1023
        pathconf("/tmp", _PC_PATH_MAX)           =  1023
        pathconf("/usr", _PC_PATH_MAX)           =  1023
        pathconf("/var", _PC_PATH_MAX)           =  1023
        pathconf("./", _PC_PATH_MAX)             =  1023
        fpathconf(fileno(stdin),  _PC_PATH_MAX)  =    -1
        fpathconf(fileno(stdout),  _PC_PATH_MAX) =    -1
        fpathconf(fileno(stderr),  _PC_PATH_MAX) =    -1
float limits:
        smallest floating-point number: 1.40129846e-45 == 2^(-149)      [IEEE 754 smallest 32-bit subnormal]
        machine epsilon:                1.19209290e-07 == 2^(-23)       [IEEE 754 32-bit conformant]
double limits:
        smallest floating-point number: 4.94065646e-324 == 2^(-1074)    [IEEE 754 smallest 64-bit subnormal]
        machine epsilon:                2.22044605e-16 == 2^(-52)       [IEEE 754 64-bit conformant]
long double limits:
        smallest floating-point number: 0.00000000e+00 == 2^(-16494)    [IEEE 754 smallest 128-bit subnormal]
        machine epsilon:                1.92592994e-34 == 2^(-112)      [IEEE 754 128-bit conformant]
        long double appears to be 128-bit value stored in 128-bit (16-byte) field
FEATURES TESTS COMPLETED

======================================================================== HP-UX 11.00/64 U A500-7X/64 PA8700/750(2) pa-2.0 2048 Mb B3901BA.C-ANSI-C B.11.11.10 HP C/ANSI C Compiler

Compiler                             = cc
Available standard predefined constant macros...
        __bool_true_false_are_defined =        1
        __DATE__                     = "Feb 11 2008"
        __FILE__                     = "features.c"
        __LINE__                     =      180
        __STDC__                     =        1
        __TIME__                     = "09:01:55"
Missing standard predefined constant macros...
        __cplusplus
        __func__
        __STDC_HOSTED__
        __STDC_IEC_559__
        __STDC_IEC_559_COMPLEX__
        __STDC_ISO_10646__
        __STDC_CONSTANT_MACROS
        __STDC_FORMAT_MACROS
        __STDC_LIMIT_MACROS
        __STDC_VERSION__
Available nonstandard but traditional header files...
        <sys/types.h>
        <varargs.h>
Missing nonstandard but traditional header files...
Available 1989 Standard C header files...
        <assert.h>
        <ctype.h>
        <errno.h>
        <float.h>
        <limits.h>
        <locale.h>
        <math.h>
        <setjmp.h>
        <signal.h>
        <stdarg.h>
        <stddef.h>
        <stdio.h>
        <stdlib.h>
        <string.h>
        <time.h>
Missing 1989 Standard C standard header files...
Available additional 1999 Standard C header files...
        <fenv.h>
        <inttypes.h>
        <stdbool.h>
        <wchar.h>
Missing additional 1999 Standard C standard header files...
        <complex.h>
        <iso646.h>
        <stdint.h>
        <tgmath.h>
        <wctype.h>
Available additional POSIX (IEEE Std 1003.1-2001) header files...
        <aio.h>
        <arpa/inet.h>
        <cpio.h>
        <dirent.h>
        <dlfcn.h>
        <fcntl.h>
        <fmtmsg.h>
        <fnmatch.h>
        <ftw.h>
        <glob.h>
        <grp.h>
        <iconv.h>
        <langinfo.h>
        <libgen.h>
        <monetary.h>
        <mqueue.h>
        <ndbm.h>
        <net/if.h>
        <netdb.h>
        <netinet/in.h>
        <netinet/tcp.h>
        <nl_types.h>
        <poll.h>
        <pthread.h>
        <pwd.h>
        <regex.h>
        <sched.h>
        <search.h>
        <semaphore.h>
        <strings.h>
        <stropts.h>
        <sys/ipc.h>
        <sys/mman.h>
        <sys/msg.h>
        <sys/resource.h>
        <sys/sem.h>
        <sys/shm.h>
        <sys/socket.h>
        <sys/stat.h>
        <sys/statvfs.h>
        <sys/time.h>
        <sys/timeb.h>
        <sys/times.h>
        <sys/types.h>
        <sys/uio.h>
        <sys/un.h>
        <sys/utsname.h>
        <sys/wait.h>
        <syslog.h>
        <tar.h>
        <termios.h>
        <ucontext.h>
        <ulimit.h>
        <unistd.h>
        <utime.h>
        <utmpx.h>
        <wordexp.h>
Missing additional POSIX (IEEE Std 1003.1-2001) header files...
        <spawn.h>
        <sys/select.h>
        <trace.h>
Pointer sizes...
        sizeof(char*)                   =    4
        sizeof(void*)                   =    4
        sizeof(void(*)(void))           =    4
Integer sizes...
        sizeof(char)                    =    1
        sizeof(short)                   =    2
        sizeof(int)                     =    4
        sizeof(long)                    =    4
        sizeof(long long)               =    8
Integer-like sizes...
        sizeof(clock_t)                 =    4
        sizeof(div_t)                   =    8
        sizeof(fpos_t)                  =    4
        sizeof(intmax_t)                =    8
        sizeof(ldiv_t)                  =    8
        sizeof(off_t)                   =    4
        sizeof(ptrdiff_t)               =    4
        sizeof(sig_atomic_t)            =    4
        sizeof(size_t)                  =    4
        sizeof(time_t)                  =    4
        sizeof(uintmax_t)               =    8
        sizeof(wchar_t)                 =    4
C++ 1998 integer-like sizes...
C99 integer-like sizes...
        sizeof(double_t)                =    8
        sizeof(fenv_t)                  =    4
        sizeof(fexcept_t)               =    4
        sizeof(float_t)                 =    4
        sizeof(int8_t)                  =    1
        sizeof(int_fast16_t)            =    4
        sizeof(int_fast32_t)            =    4
        sizeof(int_fast64_t)            =    8
        sizeof(int_fast8_t)             =    4
        sizeof(int_least16_t)           =    2
        sizeof(int_least32_t)           =    4
        sizeof(int_least64_t)           =    8
        sizeof(int_least8_t)            =    1
        sizeof(intptr_t)                =    4
        sizeof(ssize_t)                 =    4
        sizeof(uint_fast16_t)           =    4
        sizeof(uint_fast32_t)           =    4
        sizeof(uint_fast64_t)           =    8
        sizeof(uint_fast8_t)            =    4
        sizeof(uint_least16_t)          =    2
        sizeof(uint_least32_t)          =    4
        sizeof(uint_least64_t)          =    8
        sizeof(uint_least8_t)           =    1
        sizeof(uintptr_t)               =    4
        sizeof(wchar_t)                 =    4
        sizeof(wctype_t)                =    4
        sizeof(wint_t)                  =    4
        sizeof(_Bool)                   =    1
Floating-point sizes...
        sizeof(float)                   =    4
        sizeof(double)                  =    8
        sizeof(long double)             =   16
Missing data types...
        imaxdiv_t
        lldiv_t
        mbstate_t
        nothrow_t
        wctrans_t
        _Complex
        _Imaginary
fpathconf() and pathconf() tests...
        pathconf("/", _PC_NAME_MAX)              =   255
        pathconf("/bin", _PC_NAME_MAX)           =   255
        pathconf("/etc", _PC_NAME_MAX)           =   255
        pathconf("/tmp", _PC_NAME_MAX)           =   255
        pathconf("/usr", _PC_NAME_MAX)           =   255
        pathconf("/var", _PC_NAME_MAX)           =   255
        pathconf("./", _PC_NAME_MAX)             =   255
        fpathconf(fileno(stdin),  _PC_NAME_MAX)  =    -1
        fpathconf(fileno(stdout),  _PC_NAME_MAX) =    -1
        fpathconf(fileno(stderr),  _PC_NAME_MAX) =    -1
        pathconf("/", _PC_PATH_MAX)              =  1023
        pathconf("/bin", _PC_PATH_MAX)           =  1023
        pathconf("/etc", _PC_PATH_MAX)           =  1023
        pathconf("/tmp", _PC_PATH_MAX)           =  1023
        pathconf("/usr", _PC_PATH_MAX)           =  1023
        pathconf("/var", _PC_PATH_MAX)           =  1023
        pathconf("./", _PC_PATH_MAX)             =  1023
        fpathconf(fileno(stdin),  _PC_PATH_MAX)  =    -1
        fpathconf(fileno(stdout),  _PC_PATH_MAX) =    -1
        fpathconf(fileno(stderr),  _PC_PATH_MAX) =    -1
float limits:
        smallest floating-point number: 1.40129846e-45 == 2^(-149)      [IEEE 754 smallest 32-bit subnormal]
        machine epsilon:                1.19209290e-07 == 2^(-23)       [IEEE 754 32-bit conformant]
double limits:
        smallest floating-point number: 4.94065646e-324 == 2^(-1074)    [IEEE 754 smallest 64-bit subnormal]
        machine epsilon:                2.22044605e-16 == 2^(-52)       [IEEE 754 64-bit conformant]
long double limits:
        smallest floating-point number: 0.00000000e+00 == 2^(-16494)    [IEEE 754 smallest 128-bit subnormal]
        machine epsilon:                1.92592994e-34 == 2^(-112)      [IEEE 754 128-bit conformant]
        long double appears to be 128-bit value stored in 128-bit (16-byte) field
FEATURES TESTS COMPLETED
-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Daniel Barkalow· Feb 11, 2008, 16:24 UTC · re: H.Merijn Brand · lore

Re: C-compiler features

On Mon, 11 Feb 2008, H.Merijn Brand wrote:
Show 8 quoted lines
> Having to answer questions about my C-compiler isn't always that easy.
> Sometimes you need to find include files, for which you don't know if
> and if how they are used. Sometimes you need to compile test programs
> to see the behaviour, and then there is threads, 32/64 bitness etc.
> 
> I was recently pointed to http://www.math.utah.edu/pub/features/
> Which gives a nice summary of what your C/C++ compiler behaves like.
> Here's the output for HP C-ANSI-C on HP-UX 11.23/64 IPF and on 11.00

Hmm. I'm actually more curious about what language features a compiler supports (Is "inline" a keyword? Does it accept C99 comments? C99 struct initializers? Flex arrays?). Sometimes the errors you get when these aren't what the code expects are hard to identify, because the compiler comes up with some odd interpretation of the structure as what you meant but messed up, and you get a slew of inappropriate error messages, sometimes hiding the actual wrong thing. Missing header files/types/macros/declarations generally give a clear first error message.

	-Daniel
*This .sig left intentionally blank*

← back to recent threads