🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Monika Mevenkamp Thu, 30 Jul 1992 10:24
g++ bug
#202
Author: Monika Mevenkamp
Date: Thu, 30 Jul 1992 10:24
52 lines
1291 bytes
I use what the man page calls 
"g++ - GNU project C++ Compiler (v2 preliminary)".

The program: 
------
	#include <assert.h> 
	#include <istream.h>
	#include <ostream.h>
	
	class Y {
	public: 
   	   Y(int i) { y = i; cout << "init " << this << ' ' << i << "\n"; }
   	   ~Y() { cout << "kill " << this << ' ' << y << "\n";}
	private: 
   	   int  y;
	} ;
	
	int
	main(int ac, char **av)
	{
   	   char c;
   	   Y y[5] = {Y(0), Y(1), Y(2), Y(3), Y(4) };
	
   	   cout << "hello \n"; 
   	   return 0;
	} 
------

produces this output:

------
init 0xf7fff9a0 0
init 0xf7fff9a4 1
init 0xf7fff9a8 2
init 0xf7fff9ac 3
init 0xf7fff9b0 4
hello 
kill 0xf7fff9b4 0
kill 0xf7fff9b4 0
kill 0xf7fff9b4 0
kill 0xf7fff9b4 0
kill 0xf7fff9b4 0
kill 0xf7fff9b0 4
kill 0xf7fff9ac 3
kill 0xf7fff9a8 2
kill 0xf7fff9a4 1
kill 0xf7fff9a0 0
------

Seems wrong to me,

Monika
Re: g++ bug
#233
Author: Raymond Nijssen
Date: Mon, 03 Aug 1992 09:48
38 lines
1653 bytes
In article <9207301824.AA16226@enthuse.bellcore.com> monika@enthuse.bellcore.com (Monika Mevenkamp) writes:

|   	#include <assert.h> 
|   	#include <istream.h>
|   	#include <ostream.h>
|   	
|   	class Y {
|   	public: 
|      	   Y(int i) { y = i; cout << "init " << this << ' ' << i << "\n"; }
|      	   ~Y() { cout << "kill " << this << ' ' << y << "\n";}
|   	private: 
|      	   int  y;
|	} ;
|   	
|   	int
|   	main(int ac, char **av)
|   	{
|      	   char c;
|      	   Y y[5] = {Y(0), Y(1), Y(2), Y(3), Y(4) };

With gcc 2.2.1 (on HP9k/7xx), appending a `&' after Y (which is wrong IMHO) 
yields the desired output.

|   	
|      	   cout << "hello \n"; 
|      	   return 0;
|	} 

Just my $0.02 ...

Regards,
-Raymond
--
| Raymond Nijssen         | Eindhoven University of Techology                 |
|                         | Department of Electrical Engineering              |
| phone: +31-40-473373    | Design Automation Section (ES),  Room EH 7.16     |
| raymond@es.ele.tue.nl   | P.O. Box 513, 5600 MB Eindhoven, The Netherlands  |
|                         | "Trust me. I know what I'm doing" (Sledge Hammer) |
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