Semantics of ^^, Version 3 (Final?)

Rainer Deyke rainerd at eldwood.com
Wed Dec 9 01:47:34 PST 2009


Lars T. Kyllingstad wrote:
> Rainer Deyke wrote:
>> 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.

Not quite.  Under the proposal, -1^^-1 works (i.e. produces the correct
result) at compile time but fails at runtime.

-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list