Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!rutgers!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Legal initializer? Keywords: initialization initializer new Message-ID: <161@mole-end.UUCP> Date: 3 May 89 00:48:20 GMT Organization: mole-end--private system. admin: mole-end!newtnews Lines: 41 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: /* <> */ ... 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