delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/30/23:35:57

From: shankar AT chromatic DOT com (Shankar Unni)
Subject: Re: <string.h> .vs. <String.h>
30 Jan 1997 23:35:57 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <32F171AB.1980.cygnus.gnu-win32@chromatic.com>
References: <009AF2B1 DOT 418AF540 DOT 8748 AT ifk20 DOT mach DOT uni-karlsruhe DOT de>
Mime-Version: 1.0
X-Mailer: Mozilla 3.0Gold (X11; I; SunOS 5.5.1 sun4u)
Original-To: dahms AT ifk20 DOT mach DOT uni-karlsruhe DOT de
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

dahms AT ifk20 DOT mach DOT uni-karlsruhe DOT de wrote:

> I have never heard about the .h-less includes!

I assure you, it's been there since at least 1993. See
http://www.research.att.com/c++/ , which is an old (1995 April) draft of
the working paper, but a decent approximation to the overall structure,
at least, of the current document. See the libraries section.

> Would it be possible having *identical* contents for both, depending
> on _CPLUSPLUS or some such, protected from multiple includes by the same
> ifdef, or both just including another, third file with a secure name?

It's possible. Actually, the C++ standard has yet another out for this:
the C-standard headers are supposed to be "officially" included as
<cstdio>, <cstring>, etc. (i.e. truly conformant programs are not
supposed to use either <String.h> or <string.h>), which does solve the
problem.

But you can't make the same file return different things for C and C++,
since it should be possible to

 #include <string.h>
  .... strcpy(...) ....	// error if you didn't include the C part

but at the same time, 

 #include <String>
 .... strcpy(...) ....	// MUST give an error, else namespace is polluted

So you can see - until the ANSI C++ standard is out there and in common
use, this thing is a can of worms..

-- 
Shankar Unni                                  shankar AT chromatic DOT com
Chromatic Research                            (408) 752-9488
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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