digitalmars.D.bugs - [Issue 4730] New: std.c.stdlib.exit in CTFE
- d-bugmail puremagic.com (33/33) Aug 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4730
- d-bugmail puremagic.com (18/18) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4730
- d-bugmail puremagic.com (10/10) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4730
- d-bugmail puremagic.com (14/16) Jun 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4730
http://d.puremagic.com/issues/show_bug.cgi?id=4730
Summary: std.c.stdlib.exit in CTFE
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
This enhancement request comes from bug 4005
Currently (dmd 2.048) the following program prints:
test.d(3): Error: exit cannot be interpreted at compile time, because it has no
available source code
test.d(6): Error: cannot evaluate foo() at compile time
test.d(6): Error: static assert (foo() == 100) is not evaluatable at compile
time
import std.c.stdlib: exit;
int foo() {
exit(1);
return 100;
}
static assert(foo() == 100);
void main() {}
I'd like exit() to work at compile-time too, and stop the compilation
gracefully (dmd return value is the value given to exit()).
See also bug 3952
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4730
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |clugdbug yahoo.com.au
Resolution| |INVALID
Implementing a complicated corner case for an obscure and dangerous feature
would
need a extremely powerful rationale.
Marking as INVALID rather WONTFIX, because the bug report doesn't have any use
case at all.
To give an idea of the complexity: consider what would happen if it were called
speculatively, eg in a template constraint.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4730
Jacob Carlborg <doob me.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |doob me.com
Isn't this exactly what static assert is for?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4730 I don't reopen this enhancement request because I trust your judgement, but here are some answers:Marking as INVALID rather WONTFIX, because the bug report doesn't have any use case at all.Sometimes to debug normal run-time code I add a printf() followed by an exit() becuse I don't need the computation to continue after the debug print. The compile-time exit was meant to be used like that, with the compile-time string print of bug 3952 (that doesn't print a newline after the string).consider what would happen if it were called speculatively, eg in a template constraint.It's an exit(), so it has to stops the whole compiler and the whole compilation stack. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 24 2011









d-bugmail puremagic.com 