public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gdr at integrable-solutions dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/15276] Erroneous Comparisons of Negative Characters
Date: Wed, 05 May 2004 11:42:00 -0000	[thread overview]
Message-ID: <20040505114217.31422.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040504045136.15276.mckelvey@maskull.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]


------- Additional Comments From gdr at integrable-solutions dot net  2004-05-05 11:42 -------
Subject: Re:  Erroneous Comparisons of Negative Characters

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| > The issue as I see it is quite simple:  The specification in table 37
| > regarding char_traits<>::compare is clear, and it takes an
| > extraodinary interpretation to conclude that string::compare 
| > and std::strcmp should match
| 
| Therefore, you don't think that tons of code around relies on that? And, if
| a std::string and a "C" string are supposed to be so essentially different,
| what is c_str() all about?

The issue at hand is entirely different.

The question is not that « std::string and "C" string are supposed to be
so different, nor what c_str() is all about.  » 

First, the pointer returned by c_str() is not necessary a C-string
equivalent of the "content" of std::string.

Secondly, assuming a std::string was supposed to be a typedef-name for
a C-string, we would not have had a c_str() in the first place.  That
is, that member function is precisely there to povide a C view of the
contents of std::string *when that makes sense*.  

A program that assumes that a std::string is an unconditional alias
for a C-string is broken and contains security hole, by definition.

But again, the issue at hand is different.  The issue at hand
concerns the specific implementation of comparaison we have in V3.

| I think that the interpretation of the letter of the standard is easy, but,
| at the same time, I think that, perhaps

Sure, it is hard to second guess what the committee intended -- a
truism -- specifically when one does not want to believe what it wrote.


-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15276


  parent reply	other threads:[~2004-05-05 11:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-04  4:51 [Bug libstdc++/15276] New: " mckelvey at maskull dot com
2004-05-04  4:53 ` [Bug libstdc++/15276] " mckelvey at maskull dot com
2004-05-04  5:15 ` pinskia at gcc dot gnu dot org
2004-05-04  9:33 ` pcarlini at suse dot de
2004-05-05  3:18 ` mckelvey at maskull dot com
2004-05-05  8:27 ` pcarlini at suse dot de
2004-05-05  8:40 ` gdr at integrable-solutions dot net
2004-05-05  9:43 ` pcarlini at suse dot de
2004-05-05  9:56 ` pcarlini at suse dot de
2004-05-05 10:24 ` gdr at integrable-solutions dot net
2004-05-05 10:38 ` gdr at integrable-solutions dot net
2004-05-05 10:53 ` pcarlini at suse dot de
2004-05-05 11:07 ` pcarlini at suse dot de
2004-05-05 11:42 ` gdr at integrable-solutions dot net [this message]
2004-05-05 12:05 ` pcarlini at suse dot de
2004-05-05 14:55 ` gdr at integrable-solutions dot net
2004-05-05 15:19 ` pcarlini at suse dot de
2004-05-05 16:21 ` bangerth at dealii dot org
2004-05-05 16:44 ` gdr at integrable-solutions dot net
2004-05-05 17:12 ` pcarlini at suse dot de
2004-05-05 17:27 ` gdr at integrable-solutions dot net
2004-05-05 17:35 ` pcarlini at suse dot de
2004-05-05 17:36 ` sebor at roguewave dot com
2004-05-05 17:39 ` pcarlini at suse dot de
2004-05-05 17:52 ` sebor at roguewave dot com
2004-05-05 18:26 ` pcarlini at suse dot de
2004-05-05 18:28 ` gdr at integrable-solutions dot net
2004-05-05 18:32 ` gdr at integrable-solutions dot net
2004-05-05 18:35 ` gdr at integrable-solutions dot net
2004-05-05 18:42 ` pcarlini at suse dot de
2004-05-05 18:56 ` pcarlini at suse dot de
2004-05-05 19:14 ` pcarlini at suse dot de
2004-05-05 23:00 ` gdr at integrable-solutions dot net
2004-05-05 23:02 ` gdr at integrable-solutions dot net
2004-05-06  8:04 ` pcarlini at suse dot de
2004-06-20  9:48 ` pcarlini at suse dot de
2004-06-20  9:52 ` pcarlini at suse dot de
2004-07-26 21:11 ` pinskia at gcc dot gnu dot org
2004-08-05 10:59 ` [Bug libstdc++/15276] [DR 467] " pcarlini at suse dot de
2005-04-17 18:17 ` pcarlini at suse dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040505114217.31422.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).