digitalmars.D.learn - betterC mode and std.stdio File
- samrose (14/14) May 16 2020 I was writing some D with the -betterC option, which is quite
- Paul Backus (3/17) May 16 2020 Unfortunately, D's std.stdio.File is not betterC-compatible. You
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 16 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.
May 16 2020