CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

C explicit call of destructor

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 20, 2008, 08:30
Default After I destroy a fvMesh objec
  #1
Senior Member
 
Maka Mohu
Join Date: Mar 2009
Posts: 305
Rep Power: 18
maka is on a distinguished road
After I destroy a fvMesh object:
mesh.~fvMesh();
or
mesh.fvMesh::~fvMesh();

I could still use mesh variable with no complains from the compiler?! Did I do something wrong?

Thanks.
maka is offline   Reply With Quote

Old   August 20, 2008, 09:47
Default >After I destroy a fvMesh obje
  #2
nadine
Guest
 
Posts: n/a
>After I destroy a fvMesh object:
>mesh.~fvMesh();
>or
>mesh.fvMesh::~fvMesh();

I would never have thought of using the destructor function this way :-o

Not the destructor function destroys an object, but when an object is destroyed, then the destructor is called.

>I could still use mesh variable with no complains >from the compiler?!

There are several objects with an empty destructor, so calling it has no effect. But generally its a very, very bad idea.

>Did I do something wrong?

Depends on your point of view. I suggest doing something right would be to learn C++.

Nadine
  Reply With Quote

Old   August 20, 2008, 11:19
Default "Note that explicit call of d
  #3
Senior Member
 
Maka Mohu
Join Date: Mar 2009
Posts: 305
Rep Power: 18
maka is on a distinguished road
[Stroustrup2000 p. 256] "Note that explicit call of destructors ... should be avoided wherever possible. Occasionally, they are essential." Thanks for your help.
maka is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Explicit filtering in LES TJ Main CFD Forum 85 November 30, 2016 05:22
implicit or explicit laure FLUENT 2 June 2, 2007 06:45
implicit vs explicit pXYZ Main CFD Forum 2 April 21, 2006 09:48
explicit formulations Muhammad zubair FLUENT 1 June 14, 2004 00:44
Coupled Explicit Andrew Parker FLUENT 1 October 12, 2001 07:18


All times are GMT -4. The time now is 01:38.