Re: alloca (fwd)
- From: Jeff Garzik <jgarzik pobox com>
- To: gtk-devel-list redhat com
- Subject: Re: alloca (fwd)
- Date: Fri, 22 Jan 1999 00:18:25 -0500 (EST)
On Thu, 21 Jan 1999, Elliot Lee wrote:
> The other macros (strdup_a, strconcat_a, etc.) are also non-intuitive to
> use - they don't (and, for glib's purposes, can't) follow the pattern of
> their malloc-using cousins.
>
> Stack allocation needs to be done directly by the programmer, because it
> is a different beast than malloc. You're trying to generalize something
> that has enough differences from regular malloc to cause some real
> problems.
I think Tim's suggestion about the macro naming, g_alloca_strxxxxx,
provides enough of a distinction to make it obvious.
These convenience macros are optimizing for a highly common case: temp
string storage. In addition, it frees the programmer from having to
worry about freeing the results.
Jeff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]