RFC, ensureHeaped

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Nov 16 10:04:32 PST 2010


On 11/16/10 4:40 AM, Steven Schveighoffer wrote:
> On Mon, 15 Nov 2010 17:02:27 -0500, bearophile
> <bearophileHUGS at lycos.com> wrote:
>> I have even suggested a transitive @noheap annotation, similar to
>> @nothrow, that makes sure a function contains no heap allocations and
>> doesn't call other things that perform heap allocations:
>> http://d.puremagic.com/issues/show_bug.cgi?id=5219
>> The proliferation of function attributes produces "interesting" results:
>> @noheap @safe nothrow pure real sin(in real x) { ... }
>
> This is a bit much. Introducing these attributes is viral -- once you go
> @noheap, anything you call must be @noheap, and the majority of
> functions will need to be marked @noheap. The gain is marginal at best
> anyways.

Hm, interestingly a data qualifier @noheap would not need to be 
transitive as data on the stack may refer to data on the heap.

Andrei


More information about the Digitalmars-d mailing list