Integer promotion issue

Basile B. b2.temp at gmx.com
Thu Sep 9 08:30:22 UTC 2021


On Wednesday, 8 September 2021 at 20:15:36 UTC, Walter Bright 
wrote:
> Every such flag doubles the amount of testing required. And 
> global behavior flags like this will have essentially 
> unpredictable results on the code.

such flags could hypothetically be created in the source code at 
the local scope and be included in the compiler `Scope`. But 
unfortuanatly this is not the D way

```d
void v()
{
    /* code here does not obey to FLAG*/
    {$PUSH FLAG} // in dmd : sc = sc.push(...)
    /* code here obey to FLAG*/
    {$POP} // in dmd : sc = sc.pop()
    /* code here does not obey to FLAG*/
}
```

as this looks much as preprocessor things (also they are not).
This also solves the problem of reusing small samples without 
knowing that a special compiler flag is required.


More information about the Digitalmars-d mailing list