c - LONG_BIT in limits.h -
i'm writing program study , therefore have descripe few wars limits of data types. when i'm writing this:
#include <limits.h> #include <stdio.h> int main(void) { printf("%d\n", char_bit); printf("%d\n", long_bit); return 0; }
but gives me following error:
a.c: in function ‘main’: a.c:7:17: error: ‘long_bit’ undeclared (first use in function) printf("%d\n", long_bit); ^ a.c:7:17: note: each undeclared identifier reported once each function appears in
even gcc -e gives me this
int main(void) { printf("%d\n", 8); printf("%d\n", long_bit); return 0; }
but grep in limits.h doesn't give me answer. bits/xopen_lim.h has declaration , should included when
__use_xopen
is declared, manual declaration won't give me result.
so problem? in manpage says there long_bit macro gcc says no.
gcc version 4.8.0 (gcc) os arch
[edit] long_bit not c-standard, type
man 0 limits.h
and search long_bit. me there 2 entries under numerical limits , therefore think long_bit exist. , no, including bits/xopen_lim.h not realy option, because should included limits.h , not manually
your issue shouldn't defining __use_xopen
. if take @ /usr/include/features.h
see explicitly undefines , redefines these macros based on feature test macros. want define _xopen_source
instead, like:
gcc -d_xopen_source=700 -o longbit longbit.c
from features.h
:
_xopen_source includes posix , xpg things. set 500 if single unix conformance wanted, 600 sixth revision, 700 seventh revision.
_xopen_source_extended xpg things , x/open unix extensions.
also, wrt directly including xopen_lim.h:
/* * never include file directly; use <limits.h> instead. */
so, wouldn't recommend directly including it. also, see man feature_test_macros
.
Comments
Post a Comment