This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc/ansi question

Christopher Faylor wrote:
> It has been pointed out to me that I shouldn't be doing -Dunix when
> using the -ansi switch with gcc because the compiler should only define
> things which begin with an underscore.  I can fix this easily.
> Does anyone know how MSVC handles the WIN32 definitions?  Is there an
> equivalent switch for Windows which disables the definition of WIN32?
> My MSVC installation is currently hosed for some reason so I can't check
> this myself.

According to the "Microsoft Visual C++ Run-Time Library Reference" for
version 5.0:

The naming convention for all Microsoft-specific identifiers in the
run-time system (such as functions, macros, constants, variables, and
type definitions) is ANSI-compliant.  In this book, any run-time
function that follows the ANSI/ISO C standards is noted as being ANSI
compatible ANSI-compliant applications should only use these ANSI
compatible functions.

The names of Microsoft-specific functions and global variables begin
with a single underscore.  These names can be overridden only locally,
within the scope of your code.  For example, when you include Microsoft
run-time header files, you can still locally override the
Microsoft-specific function names _open by declaring a local variable of
the same name.  However, you cannot use this name for your own local
function or global variable.

The names of Microsoft-specific macros and manifest constants begin with
two underscores, or with a single leading underscore immediately
followed by an uppercase letter.  The scope of these identifiers is
absolute.  For example, you cannot use the Microsoft-specific identifier
_UPPER for this reason.


Do You Yahoo!?
Get your free address at

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]