assert and static assert and code generatio
Steven Schveighoffer
schveiguy at gmail.com
Wed Jun 14 15:53:01 UTC 2023
On 6/14/23 11:23 AM, Cecil Ward wrote:
> What if I say something like assert( x < 100 ); and let’s say I’m giving
> the compiler information in the maximum conceivable range of values,
> 0…99, so the compiler could generate better code as it now knows that
> the expression x < 200 is false and let’s say that the assert is the
> only source of information about the value range.
Yes, err.... if x < 100, then x is surely < 200? But I think that's just
a typo. That's the kind of thing that asserts can do, even if the assert
is not generated into code.
-Steve
More information about the Digitalmars-d
mailing list