Topic: the intersection of C++ and EC++


Author: stephen.clamage@sun.com (Steve Clamage)
Date: 1998/07/14
Raw View
David R Tribble <david.tribble@noSPAM.central.beasys.com> writes:

>Andrew Koenig wrote:
>> This program is not in the intersection of standard C++ and EC++,
>> because it makes use of the identifier __ecplusplus, which is
>> reserved for the implementation.

>So is '__cplusplus', but it's present on every C++ compiler.

But __cplusplus is part of the language definition. Every
standard C++ compiler is required to predefine it.

>Perhaps '__ecplusplus' should be part of the EC++ standard, for
>just this sort of coding situation you describe.  (I can do the
>same thing using a '-D' compiler option; you didn't place a
>imitation on the compiler options I am allowed to use.)

Now we're getting into what constitutes "the implementation".

The C++ "implementation" is allowed to define identifiers that
begin with a double underscore, and use them for any purpose.
A user program that declares such identifiers is not following the
rules. Third-party libraries are not part of the "implementation".

There are other recognized standards. For example, POSIX and
XOPEN place additional requirements on C headers. If I remember
correctly, a POSIX-conforming <stdio.h> must contain a function
"fileno", that returns a file descriptor for a FILE, but a standard-
C-conforming <stdio.h> must not contain a function "fileno".

No implementation can conform to both standards simultaneously,
but in reality it isn't a problem. The implementation provides
a way to enable POSIX features or disable every non-C-standard
feature, for example. The user of the implementation decides
which features (strict C conformance or POSIX conformance) apply
to the application, and puts the compiler into the appropriate
mode of operation.

If EC++ is just a third-party library, it should not use or
rely on an identifier like __ecplusplus. A C++ implementation
might already use that identifier for a different purpose,
and is allowed to do so by the C++ standard.

If EC++ is some sort of recognized standard, it might well place
additional requirements on the C++ implementation. A C++
implementation would then provide the same sort of workarounds
that it already does to accomodate POSIX or XOPEN.

--
Steve Clamage, stephen.clamage@sun.com


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]