* What are the main differences between malloc provided by libc and std::malloc?
@ 2020-08-12 7:35 孙世龙 sunshilong
2020-08-12 7:55 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: 孙世龙 sunshilong @ 2020-08-12 7:35 UTC (permalink / raw)
To: 孙世龙 sunshilong via Libc-help
What are the main differences between malloc provided by libc and std::malloc?
Could someone shed some light on this question?
Thank you for your attention to this matter.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: What are the main differences between malloc provided by libc and std::malloc?
2020-08-12 7:35 What are the main differences between malloc provided by libc and std::malloc? 孙世龙 sunshilong
@ 2020-08-12 7:55 ` Florian Weimer
2020-08-12 9:13 ` 孙世龙 sunshilong
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2020-08-12 7:55 UTC (permalink / raw)
To: 孙世龙 sunshilong via Libc-help
* 孙世龙 sunshilong via Libc-help:
> What are the main differences between malloc provided by libc and
> std::malloc?
Where do you get std:malloc? If it's from GCC's libstdc++, there are
no differents. It's the same function.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: What are the main differences between malloc provided by libc and std::malloc?
2020-08-12 7:55 ` Florian Weimer
@ 2020-08-12 9:13 ` 孙世龙 sunshilong
0 siblings, 0 replies; 3+ messages in thread
From: 孙世龙 sunshilong @ 2020-08-12 9:13 UTC (permalink / raw)
To: Florian Weimer; +Cc: 孙世龙 sunshilong via Libc-help
Thank you for taking the time to respond to my question.
>Where do you get std:malloc? If it's from GCC's libstdc++, there are
>no differents. It's the same function.
Yes, GCC's libstdc++.
Thank you for your help.
With your guidance, I find the related code snippets and comments:
/** @file include/cstdlib
* This is a Standard C++ Library file. You should @c #include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c stdlib.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
#undef free
#undef malloc
#undef realloc
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
...
using ::free;
...
using ::malloc;
...
using ::realloc;
}
---------- Forwarded message ---------
From: Florian Weimer <fw@deneb.enyo.de>
Date: Wed, Aug 12, 2020 at 3:55 PM
Subject: Re: What are the main differences between malloc provided by
libc and std::malloc?
To: 孙世龙 sunshilong via Libc-help <libc-help@sourceware.org>
Cc: 孙世龙 sunshilong <sunshilong369@gmail.com>
* 孙世龙 sunshilong via Libc-help:
> What are the main differences between malloc provided by libc and
> std::malloc?
Where do you get std:malloc? If it's from GCC's libstdc++, there are
no differents. It's the same function.
On Wed, Aug 12, 2020 at 3:55 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * 孙世龙 sunshilong via Libc-help:
>
> > What are the main differences between malloc provided by libc and
> > std::malloc?
>
> Where do you get std:malloc? If it's from GCC's libstdc++, there are
> no differents. It's the same function.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-12 9:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 7:35 What are the main differences between malloc provided by libc and std::malloc? 孙世龙 sunshilong
2020-08-12 7:55 ` Florian Weimer
2020-08-12 9:13 ` 孙世龙 sunshilong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).