What is nothrow for?
Bill Baxter
dnewsgroup at billbaxter.com
Sat Apr 26 17:12:08 PDT 2008
Janice Caron wrote:
> On 26/04/2008, Ameer Armaly <ameer.armaly at furman.edu> wrote:
>> It seems to me that the compiler could figure out whether or not a function
>> throws exceptions and act accordingly;
>
> Without the nothrow keyword, the only way it could do that is by
> checking not only the function itself, but the function bodies of all
> functions called by the function, and so, recursively, forever.
>
>
>> I really don't see why it needs to be
>> told.
>
> With nothrow, it doesn't have to recurse.
Yeh, it's the same problem with deducing things like pure and const
(which is the conclusion I came to following our previous discussion on
the topic... though I just let the thread fizzle rather than stating
this conclusion.).
If you want to have the benefits of separate compilation then you have
to tell the compiler what to expect of functions without it having to
have the bodies of those functions present.
--bb
More information about the Digitalmars-d
mailing list