From: remove_this_mimo AT restoel DOT net_and_this (mimo) Newsgroups: comp.os.msdos.djgpp Subject: c++ const definition in djgpp 2.95 problem Date: Mon, 23 Aug 1999 18:25:57 GMT Organization: MimoLand Message-ID: <37c18ffb.1378453@news.kfunigraz.ac.at> NNTP-Posting-Host: bonlineb98.kfunigraz.ac.at Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 39 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com i used to define my constants like this, following advice by someone who seemed to understand the ansi/iso c++ declaration: class c{ const char cszText[] = "Text"; const int ciNumber = 5; }; in version 2.95 of gcc this results in a compiler error. now i wonder how am i supposed to initialize constants. i found out by trying that the compiler accepts defining the consts values in the constructor, like this: c::c() : cszText("Text"), ciNumber(5) {} but in this case i would have to initialize class member cszText with a fixed value in the class definition and wherever i use ciNumber for defining const values this results in another compiler error, because the value of ciNumber is not defined in the header-file, for instance: class c{ // same as above char szBuffer[ciNumber]; }; does not work any more... do i have to use #define's again like?! or is there another way to cope with these things? cheers mimo