Ana Kedi

Ivan Kazmenko gassa at mail.ru
Mon Aug 15 16:34:29 UTC 2022


On Friday, 12 August 2022 at 23:04:50 UTC, Salih Dincer wrote:
> Hi, what do you think should have been in lieu of runtime error?
> ...

Related: there is a version statement, resembling `{$ifdef}` in 
Pascal or `#ifdef` in C, but arguably cleaner.

Consider this:

```
struct Ana
{
   char a;
   version (v1) {Kedi k;}  //  assertions complated

   union
   {
     char b;
     char p;
   }
   version (v2) {Kedi k;}  //  #.v2 (compiled it)
   union Kedi
   {
     char cat;
     char edi;
   }
   version (v3) {Kedi k;}  //  #.v3 (compiled it)
}
```

Then compile with `dmd -version v3` or the like.

Note that the `{}` for compile-time features (such as `version`, 
`debug` or `static if`) don't introduce a new scope.

Ivan Kazmenko.



More information about the Digitalmars-d mailing list