Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ use of Malloc/Realloc and Free



Jerry Feldman <gaf at blu.org> writes:

> Again, the bottom line is "use malloc(3), realloc(3), calloc(3),
> alloca(3) and free(3) in C++ at your own risk". If you know what the
> underlying implementation does, then you should have no problem. But
> also remember that on Linux, the underlying libraries can change without
>  notice so that your application may not be portable accross platforms. 

I think that this is a tiny bit too pessimistic.

It is possible to write portable C++ code that uses malloc() and
friends -- all without knowing what the underlying implementation
does.  If you follow the rules, your code will be completely
portable.  I would submit that it's not even that difficult to do
this.

malloc() and free() and new and delete etc. all do what the standards
say they should do.  As long as you use these things as they are
intended, your code will be fine.

Regards,

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org