How to declare immutable struct outside of try catch and reference it later

kdevel kdevel at vogtner.de
Sun Dec 3 14:26:29 UTC 2017


On Sunday, 3 December 2017 at 14:16:42 UTC, kdevel wrote:
> int main ()
> {
>    try {
>       real_main ();
>    }
>    catch (Exception e) {
>       std.stdio.stderr.writeln(e.msg);
>       return 1;
>    }
>    return 0;
> }
> ```

This is better:

int main ()
{
    try {
       return real_main ();
    }
    catch (Exception e) {
       std.stdio.stderr.writeln(e.msg);
       return 1;
    }
}


More information about the Digitalmars-d-learn mailing list