Re: extern(C) function declarations and extra keywords.

2014-01-19 Thread Jacob Carlborg
On 2013-12-28 22:47, Jeremy DeHaan wrote: Since the C functions can't access anything from D code save for what is passed through as parameters, can it be called pure? And if so, does the compiler know how to distinguish C and D in this instance and make it inherently pure? Does purity do anythi

Re: extern(C) function declarations and extra keywords.

2013-12-29 Thread Jakob Ovrum
On Sunday, 29 December 2013 at 14:50:52 UTC, H. S. Teoh wrote: 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 ge

Re: extern(C) function declarations and extra keywords.

2013-12-29 Thread H. S. Teoh
On Sat, Dec 28, 2013 at 09:57:06PM +, 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 funct

Re: extern(C) function declarations and extra keywords.

2013-12-28 Thread ponce
Since the C functions can't access anything from D code save for what is passed through as parameters, can it be called pure? Probably not since it might not be pure and eg. mutate global variables. Does purity do anything in terms of speed/safety here? A pure function is expected to give th