betterC mode and std.stdio File

Paul Backus snarwin at gmail.com
Sun May 17 01:36:33 UTC 2020


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.


More information about the Digitalmars-d-learn mailing list