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

From: ryot AT bigfoot DOT com (George Ryot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: c++ const definition in djgpp 2.95 problem
Message-ID: <37d3fceb.45310140@news.clara.net>
References: <37c18ffb DOT 1378453 AT news DOT kfunigraz DOT ac DOT at> <37cad280 DOT 1608331 AT news DOT kfunigraz DOT ac DOT at>
X-Newsreader: Forte Agent 1.5/32.452
X-No-Archive: yes
MIME-Version: 1.0
Lines: 28
Date: Mon, 30 Aug 1999 21:54:29 GMT
NNTP-Posting-Host: 195.8.91.248
X-Complaints-To: abuse AT clara DOT net
X-Trace: nnrp3.clara.net 936050069 195.8.91.248 (Mon, 30 Aug 1999 22:54:29 BST)
NNTP-Posting-Date: Mon, 30 Aug 1999 22:54:29 BST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

remove_this_mimo AT restoel DOT net_and_this (mimo) wrote:

> 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?).

Having read your problem again I don't think namespaces would help.

> to make it clear an example:
> 
> class c{
> 	static const int ciSize;
> 	static const apszString[ciSize];
> };

I think this is what you are looking for (UNTESTED!) :

class c{
    enum {size = 5};
    static const char sz[size] = "Text";
};

Consider using C++ strings instead of C strings, and vectors instead
of arrays, they have many advantages and your problem would probably
be a non-issue if you went this route.  Consider also my previous
suggestion if this is not enough.
-- 
george

- Raw text -


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