delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/22/13:03:16

From: DougEleveld <deleveld AT dds DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How can I tell if it's a bug from DJGPP or GCC?
Date: Tue, 22 Sep 1998 18:32:51 +0200
Organization: Rijksuniversiteit Groningen
Lines: 50
Message-ID: <3607D133.E01E67CD@dds.nl>
References: <6u7smk$9t7$1 AT nnrp1 DOT dejanews DOT com> <36078819 DOT 377336654 AT news DOT snafu DOT de>
NNTP-Posting-Host: client36-108.oprit.rug.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Horst Kraemer wrote:
> >I get these errors:
> 
> >bug1.cc:12: warning: all member functions in class `singelton' are private
> >bug1.cc:12: warning: `class singelton' only defines a private destructor and
> >has no friends bug1.cc: In function `(static destructors for bug1.cc)':
> >bug1.cc:8: `singelton::~singelton()' is private bug1.cc:33: within this
> >context
> 
> >Small problem:
> >The warning about all member functions being private and the class having no
> >friends is not useful when there are static instances of the class.
> 
> Why ?

OK, I've made a small mistake here.  There should be at least one public
member function.  I guess the warning is to tell people that they may be
making a potentially useless class.  All private constructors and no
friends means that no one can construct the object, however that's not
important if there are static instances of the class inside the class as
they should be constructed anyway.
 
> >Bug:
> >The static singleton is within the scope of class and should be able to be
> >destructed, but DJGPP is trying to destroy it at global scope.
> >*/
> 
> The scope of the declaration has nothing to do with scope of
> "destruction". The scope of "contruction" of singelton::instance is
> the scope of the class by definition. The scope of destruction is the
> scope of the definition - i.e. global scope. The d'tor is not
> accessible at global scope.

So you are saying that a static instance of a class does not have access
to it's own private constructors/destructors?  It has access to
everyting else, why not that?  I brought this up on
comp.lang.c++.moderated a little while ago and those who responded (if I
remember correctly) agreed with me, however the thread didn't recieve
very much attention.

> >---bug2.cc---
> >/* BUG: Constant enum's arent always handled correctly */
> 
> The same would happen with straightforward 'int' instead of 'enum
> index'

Yes, you are right. I guess I don't know all that much about
compile-time const stuff.  Thanks.

Doug Eleveld

- Raw text -


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