@safe, pure and nothrow at the beginning of a module

Philippe Sigaud via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 16 04:18:52 PDT 2014


>>> If I understand correctly Adam Ruppe's Cookbook, by putting
>>>
>>> @safe:
>>> pure:
>>> nothrow:
>>>
>>> at the beginning of a module, I distribute it on all definitions, right?
>>> Even methods, inner classes, and so on?

I read Adam's book again and I was wrong:

Chapter 7, p. 173:

"You may add @safe: to the top of your module and aggregate
definitions to apply the annotation to all function that follows,
instead of writing it on each individual function."

So, first, he's talking only about @safe (though I suppose it works
the same for all annotations) and he says: *and aggregate
definitions*. We indeed need to put annotations inside aggregates to
affect their innards.

If that's true, I have a lot of annotation sprinkling to do.


More information about the Digitalmars-d-learn mailing list