On Tue, 20 Aug 2013 10:16:03 +0200 Marek Paśnikowski <marekpasnikowski@marekpasnikowski.name> wrote:
Hello. I am learning C. For current exercise I need to use the ULONG_MAX from limits.h . I have the >>current milestone of OpenSUSE<< installed. In the code I have, with nothing else in between:
unsigned long int var; var=ULONG_MAX; printf("%ld",var);
When executed, the last statement of the three prints out "-1" .
gcc -ansi -Wall gives no output at all for this revision of the program. Though I have hardware capable of virtualization, I don't have the space to install a VM. I suspect it's a bug in OpenSUSE (maybe even quite old), so can someone, please, do quick check on a stable release of OpenSUSE, what value does the ULONG_MAX take?
When I examined /usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed/limits.h and /usr/include/linux/limits.h , for me it looks like a third header with __LONG_MAX__ is needed. I have had installed the devel_basis, devel_kernel and devel_C_C++ patterns.
To make it easier, here's the code to check the value:
#include<stdio.h> #include<limits.h> int main (void) { unsigned long int var; var=ULONG_MAX; printf("%ld",var); return 0; }
Maybe this helps: #include <stdio.h> #include <limits.h> int main (void) { unsigned long var; var = ULONG_MAX; printf("%lu\n",var); return 0; } -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmilasan@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org