🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2735

Re: Standard C++ Macro

#2735
From: Joe Buck
Date: Tue, 28 Nov 1995 00:32
40 lines
2232 bytes
krishtere@aol.com (Krishtere) writes:
>In the ANSI C std there is a macro something like _STD_C_ which could be
>used to determine if the compiler was ANSI-compliant:

Actually __STDC__ .  But if the draft standard were a standard, and if
such a macro existed for C++ it would always be defined to be false,
though.

>So far, all I can find that is similar is the _cplusplus macro which, it
>seems to me, tells us that we are compiling a C++ program and not a C
>program but noit necessarily an ANSI-compliant C++ program. I would like
>something that tells me the level of compliance so I can know whether or
>not I have to enum or typedef a BOOL type and other things when I use
>legacy code. Something like this:
>
>#ifdef _ANSI_CPLUS_PLUS_
>   typedef bool BOOL;  // we have the bool type
>  // other defs that are ANSI-equivalent
>#else
>   enum BOOL { FALSE=0, TRUE=!FALSE}; // no bool type
>   enum bool {false=0, true=!false};
>   // other non-ANSI stuff
>#endif

In real life, though, you'll find that all existing compilers have some
but not all features from the draft standard.  A compiler may have the
bool type but not have dynamic_cast, for example.  For the next several
years, we're probably going to have to have things like

#ifdef HAS_BOOL

etc.
-- 
-- Joe Buck 	<jbuck@synopsys.com>	(not speaking for Synopsys, Inc)
Anagrams for "information superhighway":	Enormous hairy pig with fan
						A rough whimper of insanity
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <49dhr2$b1n@hermes.synopsys.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <4998dt$j01@newsbf02.news.aol.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 28 Nov 95 00:32:33 GMT
Approved: fjh@cs.mu.oz.au
From: jbuck@Synopsys.COM (Joe Buck)
Newsgroups: comp.std.c++
Subject: Re: Standard C++ Macro
X-Original-Date: 27 Nov 1995 23:32:50 GMT
Organization: Synopsys Inc., Mountain View, CA 94043-4033
Message-ID: <49dhr2$b1n@hermes.synopsys.com>
References: <4998dt$j01@newsbf02.news.aol.com>
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMLpYsuEDnX0m9pzZAQFLpAF/SDoj7whMPesTn4+JG40Ls2KhXUf+UXBw
 +IlPluggDkWedvxjuGINpIIKbwAB/MLQ
 =anQm