[rescue] Cooling (Long Message, sorry)

Dave McGuire mcguire at neurotica.com
Thu Apr 18 16:56:51 CDT 2002


On April 18, Francisco Javier Mesa-Martinez wrote:
> Arrays should ALWAYS be static! I.e. their sizes should be known at
> compile time. This makes more efficient stack allocation, if you need
> dynamic storage use any of the data structures developed during 30+ yrs of
> computer science for that effect. Even if you are using new.
> 
> The fact that it works in certain compiler *gnuc I guess, although I
> haven't tried* doesn't mean that it is wise to employ such functionality.
> It will certainly reduce the portability of the code. 

  I have a problem with this.  If you need dynamic storage in C and
don't want the overhead of something like a linked list, a tree, or
whatever, there's nothing wrong (or unclean, or otherwise bad) with a
dynamically allocated array in C.  If properly implemented, dynamic
allocation of arrays will not impact portability in the least.

  An inexperienced C programmer says "C gives me enough rope to hang
myself."  An experienced one says "C stays out of my way and lets me
get work done efficiently."

               -Dave

-- 
Dave McGuire                                 "Mmmm.  Big."
St. Petersburg, FL                                -Den



More information about the rescue mailing list