public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8586: Compiler should warn when converting a string literal to char*
@ 2002-11-21 18:04 Matt Austern
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Austern @ 2002-11-21 18:04 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8586; it has been noted by GNATS.

From: Matt Austern <austern@apple.com>
To: Andrew Pinski <pinskia@physics.uc.edu>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/8586: Compiler should warn when converting a string literal to char*
Date: Fri, 15 Nov 2002 16:39:54 -0800

 On Friday, November 15, 2002, at 04:17 PM, Andrew Pinski wrote:
 
 > Did you try the -Wwrite-strings option?
 
 A good point!  No, I didn't notice it; I just tried -W -Wall.
 
 I suppose the only question now is whether -Wall should
 also imply -Wwrite-strings.
 
 			--Matt
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/8586: Compiler should warn when converting a string literal to char*
@ 2002-11-21 17:31 Andrew Pinski
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2002-11-21 17:31 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8586; it has been noted by GNATS.

From: Andrew Pinski <pinskia@physics.uc.edu>
To: austern@apple.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/8586: Compiler should warn when converting a string literal to char*
Date: Fri, 15 Nov 2002 16:17:33 -0800

 Did you try the -Wwrite-strings option?
 
 Thanks,
 Andrew Pinski
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* c++/8586: Compiler should warn when converting a string literal to char*
@ 2002-11-21  4:06 austern
  0 siblings, 0 replies; 3+ messages in thread
From: austern @ 2002-11-21  4:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8586
>Category:       c++
>Synopsis:       Compiler should warn when converting a string literal to char*
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 14 14:36:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Matt Austern
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
In C++, a string literal is of type const char[N].  However, there is a special conversion, just for string literals, that lets you assign a string literal to char*.

This conversion is known to be unsafe, it was put in to support legacy code that isn't const-correct, and it is deprecated.  The compiler should issue a warning when it applies that conversion.  The only issue is whether that warning should be on or off by default.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-16  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-21 18:04 c++/8586: Compiler should warn when converting a string literal to char* Matt Austern
  -- strict thread matches above, loose matches on Subject: below --
2002-11-21 17:31 Andrew Pinski
2002-11-21  4:06 austern

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).