Adding noreturn and hidefromvtls attributes
Chaiomanot
. at .
Fri Jan 11 12:25:52 PST 2013
Hello,
Is there any change would could be seeing a noreturn attribute or
way to hide a variable from the -vtls option in D in the near
future?
Sometimes it's desirable to indirectly throw an exception,
especially if there's some work that needs to be done
specifically relating to the exception about to be thrown, but
you don't want to have to clutter your code with assert(false)
every time you do. For example:
void throwEintr (string funcName) pure noreturn
{
throw new Exception (funcName ~ "() was interrupted by the OS");
}
void exacerbate (T) (const(T) exc, string msg) pure noreturn
{
throw new T (msg ~ ": " ~ exc.msg);
}
There are of course, a multitide of other potential uses for it
On hiding from -vtls. Say you want to be alerted to any
accidental thread-local variable declarations, but don't want the
compiler yelling at you for ones you know you want. Such as:
extern(C) __thread __hidefromvtls int errno;
A working implementation of both is here:
https://github.com/Chaiomanot/dmd
Appolgies if this isn't the right place to post this, I couldn't
find a suggestions forum.
More information about the Digitalmars-d
mailing list