jason.cipriani@gmail.com
12/7/2008 6:37:00 PM
On Dec 7, 11:39 am, Paavo Helde <pa...@nospam.please.ee> wrote:
> Sherm Pendley <spamt...@dot-app.org> kirjutas:
>
> > Paavo Helde <pa...@nospam.please.ee> writes:
>
> >> For using e.g. malloc() you should not declare it yourself. You should
> >> include the relevant header, e.g. <stdlib.h>
>
> > Shouldn't that be <cstdlib>?
>
> > sherm--
>
> <stdlib.h> is working and not going away. As far as I have understood,
> calling it deprecated was kind of wishful thinking in the current standard,
> and will be corrected in the next standard. IMO, the main controversy is
> that it is not understandable why I should call a C function through a name
> in std:: namespace, albeit in C there are no namespaces.
It's understandable because the C++ standard defines it as so (sorry I
do not have the document in front of me to cite section numbers). In C+
+, use <cstdlib>, and std::malloc(). It's true <stdlib.h> is not going
away, and I have to admit I frequently use it myself, but it's only
maintained for backwards compatibility with C.
I'm not so sure it will be "corrected" in the next standard (nor what
you mean by "corrected"), but they'd certainly be well within their
rights to make stdlib.h go away entirely, seeing as how it's been
deprecated for quite some time.
Jason