🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Mike Lijewski Fri, 01 Sep 1989 19:43
bug with const class objects.
#386
Author: Mike Lijewski
Date: Fri, 01 Sep 1989 19:43
49 lines
1922 bytes
The following script illustrates a program with sets a member
of a class object which is declared const using a non-const member
function.  It is my understanding that this should be flagged
during compilation as an error.


Script started on Fri Sep  1 15:30:37 1989

robbie(1)->cat b.cc

class foo{
  int x;
  public:
  void set(int i) { x = i; }
};

main(void)
{
  const foo i;

  i.set(24);
}

robbie(2)->g++ -v b.cc

g++ version 1.36.0-
 /usr/local/lib/gcc-cpp -+ -v -I/usr/local/include/g++-include -undef -D__GNU__ -D__GNUG__ -D__GNUC__ -D__cplusplus -Dunix -Di386 -Dsun386 -Dsun -D__unix__ -D__i386__ -D__sun386__ -D__sun__ b.cc /tmp/cca00814.cpp
GNU CPP version 1.35.96
 /usr/local/lib/gcc-cc1plus /tmp/cca00814.cpp -quiet -dumpbase b.cc -noreg -version -o /tmp/cca00814.s
GNU C++ version 1.36.0- (80386, Sun syntax) compiled by GNU C version 1.35.96.
default target switches: -m80387
 as -i386 /tmp/cca00814.s -o b.o
 ld -r -o /tmp/cca00814.R -Bstatic /usr/local/lib/crt0+.o b.o /usr/local/lib/libg++.a /usr/local/lib/gcc-gnulib -lc
 collect -o /tmp/cca00814.S /tmp/cca00814.R
 as /tmp/cca00814.S -o /tmp/cca00814.O
 ld -Bstatic -e _start /tmp/cca00814.R /tmp/cca00814.O
 rm -f /tmp/cca00814.R /tmp/cca00814.O

robbie(3)->exit

script done on Fri Sep  1 15:31:35 1989


-- 
Mike Lijewski  (H)607/277-7623 (W)607/255-0539 (desk)607/255-2960
Cornell National Supercomputer Facility
ARPA: mjlx@cornellf.tn.cornell.edu  BITNET: mjlx@cornellf.bitnet
SMAIL:  1122 Ellis Hollow Rd. Ithaca, NY  14850
Re: bug with const class objects.
#388
Author: Doug Schmidt
Date: Sat, 02 Sep 1989 00:13
33 lines
1480 bytes
In article <8758@batcomputer.tn.cornell.edu>, lijewski@batcomputer (Mike Lijewski) writes:
>
>The following script illustrates a program with sets a member
>of a class object which is declared const using a non-const member
>function.  It is my understanding that this should be flagged
>during compilation as an error.
>
>
>Script started on Fri Sep  1 15:30:37 1989
>
>robbie(1)->cat b.cc
>
>class foo{
>  int x;
>  public:
>  void set(int i) { x = i; }
>};
>
>main(void)
>{
>  const foo i;
>
>  i.set(24);
>}

This is fixed in a later beta release...

Doug
--
schmidt@ics.uci.edu (ARPA) |   Per me si va nella citta' dolente.
office: (714) 856-4043     |   Per me si va nell'eterno dolore.
                           |   Per me si va tra la perduta gente.
                           |   Lasciate ogni speranza o voi ch'entrate.
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