Semantics of ^^, Version 3 (Final?)

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Wed Dec 9 01:16:19 PST 2009


Rainer Deyke wrote:
> Don wrote:
>> Note that by definining the 0,1, -1 cases as "rewriting" rules rather
>> than return values, it should be clearer that they don't apply to
>> variables having those values.
> 
> I don't care if x^^y with y < 0 is 0, a runtime error, or even undefined
> behavior.  However, having different behavior if x is a compile-time
> constant than if x is a variable is unacceptable because it silently
> changes the (defined) behavior of a function when a runtime parameter is
> changed to a template parameter or vice versa, or even when the compiler
> becomes a bit more clever about CTFE.

I don't think it's a problem: Either it works as expected, or it causes 
a compile-time error.

-Lars



More information about the Digitalmars-d mailing list