from bytes to string
H. S. Teoh
hsteoh at quickfur.ath.cx
Sat Nov 27 15:28:05 UTC 2021
On Sat, Nov 27, 2021 at 03:24:43PM +0000, Coder via Digitalmars-d-learn wrote:
[...]
> Question, why a function can not be nothrow if I catch in the body?
>
> void foo() nothrow {
> import std.utf : validate, UTFException;
> try {
> validate("a");
> }
> catch(UTFException){
> }
> }
> Error: function `std.utf.validate!string.validate` is not `nothrow`
> Error: `nothrow` function `foo` may throw
Because it may throw some other kind of Exception besides UTFException.
T
--
Stop staring at me like that! It's offens... no, you'll hurt your eyes!
More information about the Digitalmars-d-learn
mailing list