Re:Hell is a multi-threaded C++ program (2006)
by WalterBright on Saturday September 02, 2017 @08:38PM
(#15159045)
> Are foreign calls assumed to be non-pure?
Yes.
> Can they be marked pure in the case that the foreign (likely C) function doesn't reference global mutable state?
Yes. Here's an example:
https://github.com/dlang/druntime/blob/master/src/core/stdc/...
It's true that the C Standard does not actually guarantee that they don't access mutable global state, but in practice they don't. We're not aware of one that does, and don't know why anyone would write one that does.
Are foreign calls assumed to be non-pure? Can they be marked pure in the case that the foreign (likely C) function doesn't reference global mutable state?