[Issue 3883] New: Line number and file name of Exception instantiation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 5 11:53:28 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3883
Summary: Line number and file name of Exception instantiation
Product: D
Version: 2.040
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: druntime
AssignedTo: sean at invisibleduck.org
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2010-03-05 11:53:25 PST ---
I suggest to add to Exception (so later it can be shown if uncaught) the line
number and file name where it was instantiated:
void foo() {
auto e = new Exception(""); // instantiation line number here
throw e;
}
void main() {
foo();
}
Exceptions get caught, rethrown, stored, etc. But in many cases they are
instantiated close to where their cause is. So knowing such line number can be
useful (if you are using a debugger this is not so useful).
The compiler fills such fields automatically, so the syntax usage of Exception
is unchanged. Such fields can be immutable, and eventually they can be read by
user code too.
The name and file name added increases the size of the Exception instances (and
the binary size too a little), but I think this can't cause problems in normal
programs.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list