Nothrow, pure in druntime
dsimcha
dsimcha at yahoo.com
Sun Jan 25 11:30:42 PST 2009
Regarding ticket 14 in druntime:
http://www.dsource.org/projects/druntime/ticket/14
I've started looking at the best way to annotate all the pure/nothrow
functions in druntime. A lot of druntime functionality calls functions from
the C standard library or the Windows/POSIX API. I figure the best way to get
started is to deal w/ these first, and then worry about the higher level stuff
that's built on to of it. These functions are obviously nothrow, since C
doesn't even support exceptions. First of all, is there a decent automated
way to fix all of the declarations for these functions so that they're nothrow?
Secondly, since we don't have the sources to the C libraries for which the
function prototypes are declared, we can't be absolutely sure about their
purity. A good portion of the ones that seem like they could be pure, mostly
math stuff like sqrt, log, etc., are probably messing w/ errno, and
theoretically they could be memoizing stuff, etc. What's a reasonable course
of action for these? It seems like pure is most useful for mathematical
functions, , so it would really be a shame not to use it here.
More information about the Digitalmars-d
mailing list