Re: System headers, compiler conformance...
- From: scott@xxxxxxxxxxxxx (Scott Lurndal)
- Date: Fri, 08 Aug 2008 21:52:45 GMT
s0suk3@xxxxxxxxx writes:
On Aug 8, 3:20=A0pm, viza <tom.viza@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
On Fri, 08 Aug 2008 12:08:45 -0700, s0suk3 wrote:y
I have a C source file that includes several system header files (namel=
<sys/types.h>, <sys/socket.h>, <unistd.h> and <netdb.h>).
When I compile it by invoking the compiler in conforming mode, it
doesn't object to the inclusion of the headers, but it gives me errors
for every function, type, etc, that I use
when I compile it in non-conforming mode, it's All Good.
Try using gcc -E to inspect the output of the pre-processor.
$ cat foo.c
#include <header.h>
$ gcc -E foo.c -o foo.cpp
$ cat foo.cpp
/* header.h header file */
int foo(int);
$
See if the headers are there.
It might be that they are included conditionally:
#ifdef SOMETHING
int foo(int);
#endif
in which case then the macro SOMETHING might not be defined in standard
mode.
You're right. Thanks. One macro that's conditioning-out something that
I need (the 'addrinfo' struct, and the getnameinfo() and
freeaddrinfo() funcs) is '__USE_POSIX', in the <netdb.h> header. So I
could define this macro in my source, but I think there are other
things that are being conditioned-out, and going through all those
header files seems cumbersome, plus that doesn't seem like a good
solution anyway.
The gcc flag I'm using is std=3Dc99. The code I have uses C99 features
that will be disabled if I don't use that flag. What do you suggest I
should do?
1) don't use the c99 features in question.
2) from the gcc man page
Even when this option is not specified, you can still use some of
the features of newer standards in so far as they do not conflict
with previous C standards. For example, you may use "__restrict__"
even when -std=c99 is not specified.
.
- References:
- System headers, compiler conformance...
- From: s0suk3
- Re: System headers, compiler conformance...
- From: viza
- Re: System headers, compiler conformance...
- From: s0suk3
- System headers, compiler conformance...
- Prev by Date: Re: System headers, compiler conformance...
- Next by Date: Re: System headers, compiler conformance...
- Previous by thread: Re: System headers, compiler conformance...
- Next by thread: Re: System headers, compiler conformance...
- Index(es):
Relevant Pages
|
Loading