What is nothrow for?
Max Samukha
nospam at nospam.com
Sat Apr 26 00:36:21 PDT 2008
On Fri, 25 Apr 2008 14:10:23 -0700, Walter Bright
<newshound1 at digitalmars.com> wrote:
>Yigal Chripun wrote:
>> BTW, what information does the compiler extract from an attribute?
>
>With nothrow, for example, it can verify that the code inside the
>function cannot propagate an exception outside of it. I have no idea how
>you could do that with a user defined attribute.
Like in .NET. And the proposed syntax was taken from C#. A number of
intrinsic attributes are treated specially by the IL compiler. For
example, DllImport, Obsolete, MarshalAs, StructLayout etc. .NET has a
nice extensible attribute system. User defined attributes can be
inspected through reflection at run-time. I guess, D could allow to
do that at compile time as well.
More information about the Digitalmars-d
mailing list