Nothrow, pure in druntime

2009-01-25 Thread dsimcha
Regarding ticket 14 in druntime: http://www.dsource.org/projects/druntime/ticket/14 I've started looking at the best way to annotate all the pure/nothrow functions in druntime. A lot of druntime functionality calls functions from the C standard library or the Windows/POSIX API. I figure the bes

Re: Nothrow, pure in druntime

2009-01-25 Thread Walter Bright
dsimcha wrote: I've started looking at the best way to annotate all the pure/nothrow functions in druntime. A lot of druntime functionality calls functions from the C standard library or the Windows/POSIX API. I figure the best way to get started is to deal w/ these first, and then worry about

Re: Nothrow, pure in druntime

2009-01-25 Thread dsimcha
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > dsimcha wrote: > > I've started looking at the best way to annotate all the pure/nothrow > > functions in druntime. A lot of druntime functionality calls functions from > > the C standard library or the Windows/POSIX API. I figu

Re: Nothrow, pure in druntime

2009-01-25 Thread Walter Bright
dsimcha wrote: I assume, when referring to the ones that do throw, you mean functions written in C++ or D, but declared w/ C linkage. If so, you could make this a per-module setting that defaults to not assuming nothrow. For example, let's say you made this pragma(Linkage, nothrow). Then, if

Re: Nothrow, pure in druntime

2009-01-26 Thread Don
Walter Bright wrote: dsimcha wrote: I assume, when referring to the ones that do throw, you mean functions written in C++ or D, but declared w/ C linkage. If so, you could make this a per-module setting that defaults to not assuming nothrow. For example, let's say you made this pragma(Linkag

Re: Nothrow, pure in druntime

2009-01-26 Thread Walter Bright
Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags in the CPU. They are entirely deterministic, but are th

Re: Nothrow, pure in druntime

2009-01-26 Thread Don
Walter Bright wrote: Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags in the CPU. They are entirely det

Re: Nothrow, pure in druntime

2009-01-26 Thread Michel Fortin
On 2009-01-25 14:39:52 -0500, Walter Bright said: I did think of making all functions that are extern(C) automatically nothrow, but was concerned that it would result in a lot of bugs and broken code from ones that did throw. It's better that way, because it allows you to write proper wrappe

Re: Nothrow, pure in druntime

2009-01-26 Thread Walter Bright
Don wrote: Walter Bright wrote: Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags in the CPU. They are

Re: Nothrow, pure in druntime

2009-01-26 Thread Michel Fortin
On 2009-01-26 14:21:18 -0500, Walter Bright said: I guess it's reasonable to argue that using the floating-point flags is sufficiently hard-core that pure and nothrow should pretend that they don't exist. Still, some functions (especially correctly-rounded floating-point i/o) go to a lot of

Re: Nothrow, pure in druntime

2009-01-27 Thread Don
Walter Bright wrote: Don wrote: Walter Bright wrote: Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags