[rescue] Cooling (Long Message, sorry)

David Passmore dpassmor at sneakers.org
Thu Apr 18 17:09:17 CDT 2002


I don't use arrays at all. Well, I should say that I don't use array
'types', except in the context of strings being an array of null-terminated
characters, which is the only time I will use variable[subscript] notation.
Otherwise, it is a glob of memory with a pointer of a certain type, and I
will reference a position in that memory via pointer + num. Really the same
thing, but a style difference.

David


On Thu, Apr 18, 2002 at 05:56:51PM -0400, Dave McGuire wrote:
> 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."



More information about the rescue mailing list