extern(C) function declarations and extra keywords.
H. S. Teoh
hsteoh at quickfur.ath.cx
Sat Dec 28 20:49:14 PST 2013
On Sat, Dec 28, 2013 at 09:57:06PM +0000, ponce wrote:
[...]
> >I noticed that in Deimos and Derelict that most(if not all) C
> >function declarations are marked as nothrow. What are the
> >speed/safety benefits of including this?
>
> No speed or safety benefit, but it allows to call these C functions
> in functions marked nothrow themselves. As a rule of thumb you can
> put nothrow systematically when binding C code.
[...]
Yes, since C code will not throw D exceptions (C doesn't know anything
about D exceptions). Unless you pass in a function pointer to a D
function that does throw an exception... but that case doesn't work for
other reasons, so it generally shouldn't be done. So, barring that, all
C code is automatically nothrow.
T
--
What do you call optometrist jokes? Vitreous humor.
More information about the Digitalmars-d-learn
mailing list