digitalmars.D.learn - When betterC triggers errors in compilation?
- eles (39/39) Oct 14 2014 Hello,
- Adam D. Ruppe (8/9) Oct 14 2014 That was just a speculative thread, that stuff isn't implemented.
- eles (2/6) Oct 14 2014 Thank you.
- ketmar via Digitalmars-d-learn (5/6) Oct 14 2014 currently betterC disables module info generation and some module
Hello, According to this: http://forum.dlang.org/post/lddug4$jgv$1 digitalmars.com "-betterC" should disable support for exception handling. So I expected dmd to reject the following code: =============================================== import std.stdio; int readDieFromFile() { auto file = File("the_file_that_contains_the_value", "r"); int die; file.readf(" %s", &die); return die; } int tryReadingFromFile() { int die; try { die = readDieFromFile(); } catch (std.exception.ErrnoException exc) { writeln("(Could not read from file; assuming 1)"); die = 1; } return die; } void main() { const int die = tryReadingFromFile(); writeln("Die value: ", die); } ======================================================= (from Ali's book; thanks once again) But it compiles and runs fine: $dmd betterC.d -betterC $./betterC (Could not read from file; assuming 1) Die value: 1 This is with dmd 2.066 on Linux x86_64. What code would fail under -betterC and how?
Oct 14 2014
On Tuesday, 14 October 2014 at 13:20:50 UTC, eles wrote:http://forum.dlang.org/post/lddug4$jgv$1 digitalmars.comThat was just a speculative thread, that stuff isn't implemented. (And I think that went way too far, IMO betterC should just remove the mandatory stuff like ModuleInfo and TypeInfo assumptions and leave the rest to be opt in. I'd be against it making exception handling an error). -betterC right now is still an undocumented hack that doesn't do much.
Oct 14 2014
On Tuesday, 14 October 2014 at 13:31:47 UTC, Adam D. Ruppe wrote:On Tuesday, 14 October 2014 at 13:20:50 UTC, eles wrote:http://forum.dlang.org/post/lddug4$jgv$1 digitalmars.com-betterC right now is still an undocumented hack that doesn't do much.Thank you.
Oct 14 2014
On Tue, 14 Oct 2014 13:20:49 +0000 eles via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:What code would fail under -betterC and how?currently betterC disables module info generation and some module helper functions generation. that's all. just grep DMD sources for "betterC" and you'll see it.
Oct 14 2014