> #include <stdio.h>
> #include <time.h>
> #include <sys/time.h>
> 
> int main(void)
> {
>     hrtime_t time1 = gethrtime();
>     hrtime_t time2 = gethrtime();
>     printf("elapsed: %lli\n", time2 - time1);
>     return 0;
> }
> 
> $ /opt/SUNWspro8/bin/cc -o t t.c
> $ gcc -o t t.c
> 
> ANSI compilations fail:
> 
> $ gcc -ansi -o t t.c
> t.c: In function `main':
> t.c:9: error: invalid operands to binary -
> $ /opt/SUNWspro8/bin/cc -Xc -o t t.c
> "t.c", line 9: operands have incompatible types:
>          union  {double _d, array[2] of int _l} "-" union  {double _d, 
> array[2] of int _l}
> cc: acomp failed for t.c

The definition of -Xc is strict ISO conformance to the version of ISO C that
preceded C99.  That standard didn't include long longs, so you're getting
exactly what you're asking for.  This is why Sun compilers have always used
-Xa as the default conformance mode prior to our implementation of ISO C99.
You should avoid setting -X<c> at all when compiling code on Solaris with the
Sun compilers unless it is absolutely necessary.  If you truly need 100%
standard conformance and long longs, then you need to use the more recent
compilers and enable c99 mode.

-Mike
 
-- 
Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code

Reply via email to