🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by OVE EWERLID Tue, 25 Apr 1989 23:28
Semicolon can be replaced by dummy function!
#1907
Author: OVE EWERLID
Date: Tue, 25 Apr 1989 23:28
55 lines
1357 bytes
If this has been reported before, please ignore!

G++ 1.35-, running on a sun3;

Consider:

	-+-		-+-		-+-

class Test
{
protected:
  double xx, yy, zz;
public:
  Test(doubel, double, double);
}   		// Semicolon missing!

dummy(){}	// This seems to replace the missing semicolon after the class!

inline Test::Test(double x, doubel y, double z)
{
  xx=x; yy=y; zz=z;
}

main(){}

	-+-		-+-		-+-


// The above compiles, but should it?
// I think the answer is no as the above is invalid C++!
// Now look at the this:


	-+-		-+-		-+-

class Test
{
protected:
  double xx, yy, zz;
public:
  Test(doubel, double, double);
};   // The semicolon added

inline Test::Test(double x, doubel y, double z)
{
  xx=x; yy=y; zz=z;
}


	-+-		-+-		-+-

// which is the valid C++ code.
// The bug seems to be the fact that one can leave out the semicolon
// after a class definition and replace it with a dummy function.
// I haven't checked, but it may also apply to structs.
Semicolon can be replaced by dummy function!
#1908
Author: Michael Tiemann
Date: Wed, 26 Apr 1989 15:35
29 lines
1085 bytes
   class Test
   {
   protected:
     double xx, yy, zz;
   public:
     Test(doubel, double, double);
   }   		// Semicolon missing!
   
   dummy(){}	// This seems to replace the missing semicolon after the class!
   
   inline Test::Test(double x, doubel y, double z)
   {
     xx=x; yy=y; zz=z;
   }
   
You get what you deserve when you say

	dummy(){}

instead of

	int dummy(){}

If you specify the return type, the compiler will issue an error
message.  Otherwise it needs infinite lookahead to determine whether
or not you made an erroneous declaration.

Michael
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