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

Vlad Levenfeld via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 15 16:22:25 PDT 2014


On Friday, 15 August 2014 at 16:54:54 UTC, Philippe Sigaud wrote:
> So I'm trying to use @safe, pure and nothrow.
>
> 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?
>
> Because I did just that on half a dozen of modules and the 
> compiler did not complain. Does that mean my code is clean(?) 
> or that what I did has no effect?

I've noticed the same thing. If I want pure and nothrow to 
propage to inner structs and classes I have to place another 
label inside the class definition. Otherwise only free functions 
are affected.



More information about the Digitalmars-d-learn mailing list