delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/30/22:05:10

From: remove_this_mimo AT restoel DOT net_and_this (mimo)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: c++ const definition in djgpp 2.95 problem
Date: Mon, 30 Aug 1999 19:11:56 GMT
Organization: MimoLand
Message-ID: <37cad280.1608331@news.kfunigraz.ac.at>
References: <37c18ffb DOT 1378453 AT news DOT kfunigraz DOT ac DOT at>
NNTP-Posting-Host: bonlineb126.kfunigraz.ac.at
Mime-Version: 1.0
Lines: 35
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

first of all thanks for your replies. i am afraid i didn't explain my
problem and aim exactly enough - as a matter of fact i only found out
today while reading the replies waht my aim really was.
according to this one c++ reference i used to read this way of
defining constants was meant to replace c-style-macros (#define). in
version 2.81 it was possibly to define constants this way. 
the positive effect was that the constants were parsed by the
prerpocessor (think so...) means that they were treated more or less
like c-macros. at the same time they were "clean" and free from
typical c problems. that's one reason why i don't want to define
anything in the global scope as someone proposed. namespaces were not
implemented in version 2.81 (could anybody could give me an example of
how to use them?).
the other solution - using static member constants - differs from the
stated aim. defining a constant this way results in having more class
mebers than before (again think so...), means that static members are
simply not the same as this precompiler-"trick". 
to make it clear an example:

class c{
	static const int ciSize;
	static const apszString[ciSize];
};

this simply cannot be done with static members since at the time when
the precompiler (??) reaches the second const it doesn't know the
value of ciSize. i am rather sure that this is also the reason for the
internal compiler error, which could be avoided if it were still
possible to define consts the way i used to do. 
maybe there is another workaround - thanks in advance.

cheers 

mimo

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019