On Sep 2, 2013, at 1:22 AM, Richard Sandiford <rdsandif...@googlemail.com> wrote: > What I'm saying is that the assert stops plain: > > max_wide_int x = wide_int_var;
Sorry for being slow. I see the point, indeed, from the preexisting code, we did: fixed_wide_int (const wide_int_ro w) : wide_int_ro (w) { /* We only allow the same size in, as otherwise we would not know how to extend it. */ gcc_assert (precision == bitsize); } to disallow it dynamically. Doing this, or pushing it further into the type system so that it is caught a compile time, is fine. I also like the passing of sign: max_wide_int x = max_wide_int::from (wide_int_var, SIGNED); max_wide_int x = max_wide_int::from (wide_int_var, UNSIGNED); like this. In the previous code we did: static inline fixed_wide_int from_wide_int (const wide_int& w) { if (w.neg_p (SIGNED)) return w.sforce_to_size (bitsize); return w.zforce_to_size (bitsize); } which is, as you point out, dangerous.