Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zeusel

new / calloc

This topic is 6004 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
They should be exactly the same althought i expect that new may use up a bit more memory, keeping track of what you''ve new''d.

I personally use alloc because i''m used to it, i know if i start using new half way through a project i''ll keep forgetting to delete(?) them. Then again it does seem like a far neater option.

Share this post


Link to post
Share on other sites
The calloc function is just like malloc except that it zero''s out the memory at the same time (this is unneeded most of the time, and lowers the speed). If you''re using C++ just stick with new and delete.

quote:
Original post by Prosper/LOADED
since C is not OO

Neither is C++. C++ just has added capabilities for working in an OO paradigm. Therefore, C++ is multiparadigm, not OO. OO code is still very possible in C (look at GTK+).

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
quote:

I personally use alloc because i'm used to it, i know if i start using new half way through a project i'll keep forgetting to delete(?) them. Then again it does seem like a far neater option.



Doesn't you need to call free after calling malloc?

Edited by - hewhay on January 13, 2002 4:27:04 PM

Share this post


Link to post
Share on other sites
quote:
Original post by zipless
They should be exactly the same althought i expect that new may use up a bit more memory, keeping track of what you''ve new''d.



So does malloc().

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!