🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Thu, 26 Jan 1989 05:28
g++ 1.32 is lax on protection
#1656
Author: "Douglas C. Schmidt"
Date: Thu, 26 Jan 1989 05:28
27 lines
966 bytes
According to page 3 of the USENIX Lime book, the following program
is incorrect:

----------------------------------------
class X {
protected:
   int prot;
};

class Y : public X {
   void mf ();
};

void Y::mf()
{
   prot = 2;
   X a;
   a.prot = 3; // error, prot is protected and a is not a Y!
   X *p = this;
   p->prot = 3; // error, prot is protected and p is not a pointer to Y!
}
----------------------------------------

However, g++ 1.32 does not complain about this.

Doug
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