This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: memsetting a locale object


> #include <locale>
> using namespace std;
> int main()
> {
>	locale* foobar = new locale("foo");
>	memset(foobar,0,sizeof(class locale));
>	delete foobar;
> }

As a user of the standard C++ library, it is *never* correct to
externally call memset() on top of a library object properly
constructed by the C++ run-time system.  We would not accept any patch
to the library to make the above code "work".  This is truly a case
where dumping core is better.

Regards,
Loren


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]