www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/20/02:06:28

Date: Thu, 20 Feb 1997 08:58:20 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Variable length array ?
In-Reply-To: <5efi13$s1o@news.ox.ac.uk>
Message-ID: <Pine.SUN.3.91.970220085615.25071F-100000@is>
MIME-Version: 1.0

On 19 Feb 1997, George Foot wrote:

> Note that variable length arrays are a gcc extension. For portability you
> should use:
> 
> int *arr=(int *)malloc(i*sizeof(int));

A better way would be to use `alloca'.  It is slightly less portable than 
`malloc', but much faster and more convenient if you don't need large 
buffers (no need to free the buffer, less heap fragmentation, etc).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019