473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

what are static destructors? disadvantages? .. TIA

2 6755
<so*****@somedomain.net> wrote...


IIUIC, a "static destructor" is a static member function of the class
that accepts one argument - a pointer to the object of that class to
be destroyed. It is probably used along with "a factory method", when
there is a need to restrict the creation of instances of some class to
free store only and/or perform additional steps before or after
creation of an object. Similar steps may need to be taken before
and/or after destroying an instance. That's that the "static
destructor" is for. I don't think it is proper to use those words
without double quotes since there is no real destructor that is static,
it's only a pretend destructor.

Disadvantages? Compared to what? To a non-static (real) destructor?
Hmm... I am looking for a good analogy here... What are the
disadvantages of a sorted collection versus non-sorted one? Can you
answer that question? Every idiom has its application. Advantages or
disadvantages, you often just have to use a certain idiom. I guess I
am simply trying to avoid answering that question. I really just
don't see it as valid.

V
Jul 22 '05 #2
Victor,

Thanks for your reply. I am a newbie, so was curious at the very
notion of "static destructor". Thanks again.

cheer.
K.

On Wed, 18 Aug 2004 00:55:35 GMT, "Victor Bazarov"
<v.********@comAcast.net> wrote:
<so*****@somedomain.net> wrote...


IIUIC, a "static destructor" is a static member function of the class
that accepts one argument - a pointer to the object of that class to
be destroyed. It is probably used along with "a factory method", when
there is a need to restrict the creation of instances of some class to
free store only and/or perform additional steps before or after
creation of an object. Similar steps may need to be taken before
and/or after destroying an instance. That's that the "static
destructor" is for. I don't think it is proper to use those words
without double quotes since there is no real destructor that is static,
it's only a pretend destructor.

Disadvantages? Compared to what? To a non-static (real) destructor?
Hmm... I am looking for a good analogy here... What are the
disadvantages of a sorted collection versus non-sorted one? Can you
answer that question? Every idiom has its application. Advantages or
disadvantages, you often just have to use a certain idiom. I guess I
am simply trying to avoid answering that question. I really just
don't see it as valid.

V


Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Amit | last post by:
is there anything like static constructors or destructors in C++ ? if yes, how to implement it? Thanks, Amit.
13
by: Adam H. Peterson | last post by:
I just made an observation and I wondered if it's generally known (or if I'm missing something). My observation is that static protected members are essentially useless, only a hint to the user. ...
0
by: Joanna Carter \(TeamB\) | last post by:
Following on from the other discussion, I have to just check something out with reference to disposal of resources held in static fields. I have a Persistence Framework that is 'globally...
12
by: Joe Narissi | last post by:
I know how to create and use static constructors, but is there a such thing as a static destructor? If not, then how do you deallocate memory intialized in the static constructor? Thanks in...
24
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
4
by: Morgan Cheng | last post by:
In C#, we can initialize static member variables in static constructor. Now, when to destruct these static member variables? If these variables hold external reference(e.g. log file stream), it is...
3
by: donna.lenharth | last post by:
Hello, I am debugging a C++ application that was ported from PostgreSQL to DB2 UDB (v8.1.0.112) on Linux and have run across a problem. We have a singleton object that handles connection...
8
by: jayaramganapathy | last post by:
Hello friends, I have a map like std::map< std::string , std::map<std::string, std::string>* EpPropCache::propertyCache ; (This is a static instance and taken from *.cpp file) As you can see...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.