try/catch idiom in std.datetime
Jacob Carlborg
doob at me.com
Mon Nov 18 02:53:50 PST 2013
On 2013-11-18 11:16, Daniel Murphy wrote:
> Yeah. On the other hand, if we decide assert(0) means 'assume unreachable'
> we can optimize out the try-catch in release mode, among other things.
>
> try { s } catch { assert(0); } -> s
> if (e) assert(0); else s; -> e; s;
"assume" isn't the same as the compile will do this. Currently the spec
says "Either AssertError is thrown at runtime if it is reachable, or the
execution is halted". To me that means an implementation is free to
throw an AssertError.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list