May 16, 2020 betterC mode and std.stdio File | ||||
---|---|---|---|---|
| ||||
I was writing some D with the -betterC option, which is quite nice. I was wondering if it is possible to use std.stdio File reading with the -betterC option. It is working with -debug mode build but I get an error when building with release: ``` /usr/local/opt/dmd/include/dlang/dmd/std/exception.d(516,9): Error: Cannot use throw statements with -betterC /usr/local/opt/dmd/include/dlang/dmd/std/exception.d(437,21): Error: template instance std.exception.bailOut!(ErrnoException) error instantiating ``` which seems to be cause by the stdio code using exceptions which doesn't work for betterC. |
May 17, 2020 Re: betterC mode and std.stdio File | ||||
---|---|---|---|---|
| ||||
Posted in reply to samrose | On Saturday, 16 May 2020 at 23:00:46 UTC, samrose wrote:
> I was writing some D with the -betterC option, which is quite nice. I was wondering if it is possible to use std.stdio File reading with the -betterC option.
>
> It is working with -debug mode build but I get an error when building with release:
>
> ```
> /usr/local/opt/dmd/include/dlang/dmd/std/exception.d(516,9): Error: Cannot use throw statements with -betterC
> /usr/local/opt/dmd/include/dlang/dmd/std/exception.d(437,21): Error: template instance std.exception.bailOut!(ErrnoException) error instantiating
> ```
>
> which seems to be cause by the stdio code using exceptions which doesn't work for betterC.
Unfortunately, D's std.stdio.File is not betterC-compatible. You will have to use core.stdc.stdio instead.
|
Copyright © 1999-2021 by the D Language Foundation