final struct ?

wjoe invalid at example.com
Wed May 20 11:36:47 UTC 2020


On Wednesday, 20 May 2020 at 04:40:33 UTC, user1234 wrote:
> On Tuesday, 19 May 2020 at 10:29:51 UTC, wjoe wrote:
>> On Tuesday, 19 May 2020 at 10:08:37 UTC, user1234 wrote:
>>> [...]
>>
>> Thank you.
>
> A little sample to show you more cases of attributes that have 
> no effect:
>
> ---
> struct Foo
> {
>     nothrow @nogc int field; // why not ?
>
>     void func()
>     {
>         void nested() const
>         {
>             field++;      // mutation is allowed because const 
> is a noop
>             extern int j; // extern decl in a nested func...
>         }
>
>         nothrow i = 8;    // just like auto
>         pure f = 9;       // just like auto
>         @safe s = 10;     // just like auto
>         @system t = s;    // just like auto
>     }
> }
>
> void main() { }
> ---

much appreciated :)


More information about the Digitalmars-d-learn mailing list