[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU attributes

From: Stefan Monnier <address@hidden>
Subject: Re: GNU attributes
Date: 25 Mar 2003 12:17:40 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Derek" == Derek Robert Price <address@hidden> writes:
> Anyone know whether a function that allocates memory can be considered
> "pure", in the GNU attribute sense of the term?

IIUC, the notion of a `pure' function is one whose return value
is all the matters and is 100% determined by its arguments.
I.e. a call to such a function can be removed if the result is not used
and two calls can be CSE'd if the args are the same.

I.e. if the function only uses malloc'd memory internally (i.e. and
frees it before returning), then it's not a problem.  Also if it
returns malloc'd memory but it doesn't matter whether it's a brand new
block or an old one, it's OK as well (this case is less common since
it can make it difficult for the caller to know when to deallocate
the returned block).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]