🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jim Lynch Sat, 02 Jan 1993 14:31
I think I found a bug (or at least an annoyance)
#736
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads