delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/08/07:07:24

Message-ID: <002201c0796b$88d9a380$d90d893e@oemcomputer>
From: "Stephen Silver" <djgpp AT argentum DOT freeserve DOT co DOT uk>
To: <djgpp-workers AT delorie DOT com>
Subject: Re: namespace std
Date: Mon, 8 Jan 2001 12:07:09 -0000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:

> On Sun, 7 Jan 2001, Stephen Silver wrote:

> > #ifdef __cplusplus
> > namespace std {
> > extern "C" {
> > #endif
>
> Question: will this compile with the current C and C++ compilers?

Yes.  I don't know when GCC started supporting 'namespace' and 'using',
but it certainly works in GCC 2.95.2.

> > #if !defined(__dj_no_hoist_) && !defined(__dj_ENFORCE_ANSI_FREESTANDING)

Just to repeat my earlier correction, this should be

#if defined(__cplusplus) && !defined(__dj_no_hoist_) \
   && !defined(__dj_ENFORCE_ANSI_FREESTANDING)

otherwise the C compiler will choke.

> > 
> > // hoist all standard foo.h symbols here
>
> Please explain to the uninitiated what does ``hoisting'' do.  An example 
> would be nice.

I meant it in the sense ``pulling up from namespace std into the
global namespace by means of a using declaration''.  For example:  

  using std::printf;

does this to printf.  This means that the <*.h> headers effectively
define their stuff in the global namespace (as well as in namespace std),
so that they can be used the same in C++ as they are in C.  By contrast,
the <c*> headers should define things only in namespace std, like all
other C++ header files.

I intend to post a patch for one of the .h files later today, which
should make things clearer.

> > PS.  One of the 18 headers common to C and C++ is missing altogether
> > from DJGPP 2.03.  Here's all that is needed for <iso646.h>:
>
> Yes, DJGPP doesn't really support the ISO amendments to C89.

But presumably this is something you wish to rectify, as you recently
said on comp.os.msdos.djgpp that volunteers are welcome to work on
adding C99 functionality.

Stephen

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019