This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13684] local static object variable constructed once but ctors and dtors called multiple times on same memory when called in multiple threads
- From: "dhruvbird at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Apr 2005 16:56:17 -0000
- Subject: [Bug c++/13684] local static object variable constructed once but ctors and dtors called multiple times on same memory when called in multiple threads
- References: <20040114172507.13684.evijaykumar@yahoo.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dhruvbird at yahoo dot com 2005-04-13 16:56 -------
(In reply to comment #19)
> I want to emphasize here again one principle of C and C++: Trust the
> programmers, and allow them to do low-level tunings for performance. Or what is
> the purpose of C++ (when compared with "high-level" languages like Python)?
> This "fix" rid the programmers of their right to choose the way they want.
>
> Unless the future C++ standard demands protection in such cases, I do not think
> the compiler-provided mechanism a good idea.
I would agree with you.
Btw, what is the approach adopted in case the app. is a single threaded one? Are
the locks still taken in this case? Also, if it is an mt-app. but the programmer
is sure that that particula function will NOT be reentrant, why should he pay
the penalty of a lock or/and a check every time the function is called?
Stroustrup continuously emphasised that C++ was designed to be as fast if not
faster than C in most respects, and I guess that's why C++ is gaining
popularity. If it were to use the java approach then it would be just another
bloat-language....
-Dhruv.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13684