<p dir="ltr">On 21 Jul 2014 22:10, "Artur Skawina via Digitalmars-d" <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br>
><br>
> On 07/21/14 21:53, via Digitalmars-d wrote:<br>
> > On Monday, 21 July 2014 at 19:33:32 UTC, Artur Skawina via Digitalmars-d wrote:<br>
> >> Disallowing integer overflow just at CT is not (sanely) possible<br>
> >> in a language with D's CTFE capabilities. (Would result in code<br>
> >> that compiles and works at runtime, but is not ctfe-able)<br>
> ><br>
> > I'd like to see compile time _constants_ be unbounded rational numbers with explicit truncation. It is when you assign it to an in-memory location that you need to worry about bounds. The same goes for calculations that doesn't do division.<br>

> ><br>
> > No need to copy the bad parts of C.<br>
><br>
> Actually, C/C++ could get away with treating overflow during constant<br>
> folding as an error (or at least emitting a warning) because of the<br>
> lack of CTFE (and no templates in C's case). The code will either<br>
> compile or it won't.<br>
> For D that is not possible -- if an expression is valid at run-time<br>
> then it should be valid at compile-time (and obviously yield the same<br>
> value).</p>
<p dir="ltr">...most of the time.</p>
<p dir="ltr">CTFE is allowed to do things at an arbitrary precision in mid-flight when evaluating an expression.</p>
<p dir="ltr">Iain</p>