TR library extensions

Martin Sebor sebor@roguewave.com
Mon Oct 6 19:28:00 GMT 2003


Gabriel Dos Reis wrote:

> Martin Sebor <sebor@roguewave.com> writes:
> 
> | So I agree with Petur: a quality implementation of C++ such as gcc
> | should provide an option for programs to choose the version of the
> | C++ standard they want to conform to, and the compiler should
> | diagnose detectable violations when the option is selected.
> 
> By that definition of "strict conformance" you're also arguing for
> rejecting a program that includes <unistd.h>.

I am not. I thought I explained why. If gcc also supplied its own
implementation of POSIX and, say, Win32, (or even just the headers),
with an option to select which of the two to conform to, I would
expect programs that #include headers from the other to be diagnosed.
But because it doesn't users can't reasonably expect it to do so.

> 
> As far as the standard goes, whether <unistd.h> is accepted is
> at best implementation defined.  By that same token, accepting <types>
> is implementation defined.

Yes, but the two are quite different since one is part of the
implementation of the compiler and the other is not.

> If your documentation tells you that
> configuring the compiler with TR support will include TR semantics,
> that is it.  Just like we do for C99 stuff.  We don't reject programs
> that happen to include <tgmath.h> just on the mere assumption that
> -std=c++98 is specified.

I don't know how C99 support works in gcc but I would find the setup
that you're describing not as useful as it could be and the mechanism
necessary to make it so too heavyweight. It should be possible to use
the same compiler for both strict conformance (e.g., when porting from
gcc to another implementation) or to enable extensions (e.g., when
porting from another implementation to gcc). I don't think it should
be necessary to configure and install two different compilers just to
get functionality that can be easily provided by one. Not all users
can configure and install compilers on their systems. I'm sure you
don't expect to have to install a separate compiler for debugging
or thread safety in addition to the optimized and non-thread-safe
versions of the same, or to install a different version of an OS
for each of its API-conformance configurations controlled by the
various macros.

Martin




More information about the Libstdc++ mailing list