On Tue, 2007-05-22 at 14:36 -0600, Stuart Jansen wrote:
> Although I won't argue that putting the data on the stack might be
> smarter, I will warn you that you should make your dependence on a small
> data size explicit. Perhaps by including an assert() or similar at the
> start of the function.

For nice small things like buffers (where there's no recursion
involved), alloca is a godsend.  

For everything else, and if you can use C++, a good C++ class with a
proper destructor is highly recommended.  People who complain about
memory management in C++ rarely know how to use a destructor properly,
nor do they understand who scope works in conjunction with that.  Once
you do, memory leaks in C++ are largely eliminated.

> 
> You haven't lived until you've debugged someone else's accidental stack
> smasher with production down at 4am.


> 
> --------------------
> BYU Unix Users Group 
> http://uug.byu.edu/ 
> 
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to