This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-ansi, POSIX etc basic questions?
- From: Phil Prentice <philp dot cheer at btinternet dot com>
- To: gcc-help at gnu dot org,gcc at gnu dot org
- Date: Fri, 24 Sep 2004 11:29:29 +0100
- Subject: -ansi, POSIX etc basic questions?
Hi
I have some basic questions around compiler definitions. I am porting some
code which contains a mixture of BSD & SVR4 from Solaris to Linux.
Forgive me if some of these questions are rather basic.
1) I have been using the -ansi flag definition, because that seemed the
right thing to do? I seem to remember that -ansi will (where possible) check
prototyping and will define the __STDC__ definition.
Am I correct to be trying to use this -ansi flag????
2) The sad thing is that if I use the -ansi flag it stops many of the 'C'
files from compiling. For example MAXNAMLEN will be undefined or things like
u_long or S_IFDIR will not be defined. I presume that this is related to
compiler definitions like __USE_BSD or __USE_POSIX or __USE_XOPEN etc
Presumably -ansi is automatically turning some of these compiler
definitions off??
Should I be defining these definitions (as required) when I'm building
the 'C' files using -ansi????
Any other suggestions?
Currently in many cases I am simply defining these defn's as part of
the C source.....not the most ideal solution.
3) Can I get the compiler to somehow list out the compiler definitions
that it is using?
Thank You very much for your time
Phil Prentice