Ana Kedi
bauss
jacobbauss at gmail.com
Tue Aug 16 06:16:23 UTC 2022
On Monday, 15 August 2022 at 16:34:29 UTC, Ivan Kazmenko wrote:
> 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.
debug creates a new scope.
More information about the Digitalmars-d
mailing list