mat@mole-end.UUCP (Mark A Terribile) (05/03/89)
class My_buf
{
public:
const int size;
char *const buffer;
My_buf( int );
};
Now, is this constructor legal?
My_buf::My_buf( int sz )
: size( sz ), buffer( new char[ sz ] )
{}
cfront (the Glockenspiel port) quietly generates bad code:
/* <<cfront 05/20/86>> */
...
struct My_buf *_My_buf__ctor (_auto_this , _auto_sz )register struct
My_buf *_auto_this ;
int _auto_sz ;
{ ...
... _auto_this -> _My_buf_buffer = (new char [_auto_sz ]) ...
^^^^^^^^^^^^^^^^^^^^
I *knows* this ain't
legal C ...
Am I doing something patently illegal (in which case I should learn C++ or
shut up) or is this something that should be reported back to The Vendor as
a problem? (Actually, it's a problem either way ...)
--
(This man's opinions are his own.)
From mole-end Mark Terribile
jss@hector.UUCP (Jerry Schwarz) (05/03/89)
In article <161@mole-end.UUCP> mat@mole-end.UUCP (Mark A Terribile) asks about ------------- class My_buf { public: const int size; char *const buffer; My_buf( int ); }; Now, is this constructor legal? My_buf::My_buf( int sz ) : size( sz ), buffer( new char[ sz ] ) {} ------------- Yes its legal. >cfront (the Glockenspiel port) quietly generates bad code: > Anytime a cfront based compiler quietly generates bad C it is a bug in cfront. This is what we mean when we say that cfront is a compiler not a preprocessor. This is true even if the C++ program being compiled was itself in error in some way. Jerry Schwarz AT&T Bell Labs, Murray Hill
ark@alice.UUCP (Andrew Koenig) (05/04/89)
In article <161@mole-end.UUCP>, mat@mole-end.UUCP (Mark A Terribile) asks about the legality of the following: class My_buf { public: const int size; char *const buffer; My_buf( int ); }; My_buf::My_buf( int sz ) : size( sz ), buffer( new char[ sz ] ) {} He points out that his version of cfront generates bad C code. Well, he's right -- it's a cfront bug. It'll work in 2.0. -- --Andrew Koenig ark@europa.att.com