🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #736

I think I found a bug (or at least an annoyance)

#736
From: Jim Lynch
Date: Sat, 02 Jan 1993 14:31
26 lines
1238 bytes
OK, my example of before, I found out why it was dumping core.

When you define:

char *x = "abcde" ;

is x an implied const? If it is, gcc is not reporting an error it should
be (I think).

If I declare a function like this,

void y(char &x) ;

it's saying I want to modify the value of x within the function. I quote from
Stroustrup, section 4.6.3, "Argument Passing", page 125:

  The absence of 'const' in the declaration of a reference argument is taken
  as a statement of intent to modify the variable:

      void g(large& arg);  // assumes that g() modifies arg

Given this, any const object passed to such a formal parameter should be
flagged as a compiler error.

I would personally have appreciated gcc 2.3.2 (sparc.sun.sunos4.1.3) if it
would have done so.
Technical Details
Message-ID: <1993Jan2.143131.6791@netcom.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!howland.reston.ans.net!paladin.american.edu!gatech!swrinde!elroy.jpl.nasa.gov!decwrl!csus.edu!netcom.com!jimlynch

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!howland.reston.ans.net!paladin.american.edu!gatech!swrinde!elroy.jpl.nasa.gov!decwrl!csus.edu!netcom.com!jimlynch
From: jimlynch@netcom.com (Jim Lynch)
Subject: I think I found a bug (or at least an annoyance)
Message-ID: <1993Jan2.143131.6791@netcom.com>
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
Date: Sat, 2 Jan 1993 14:31:31 GMT
Lines: 26