d的ldc与dmd有差异.
int i;
byte b = i & 0xFF;
//d的值传播
ubyte a, b, c;
a = b | c;
运行得很好
module test;
import std;
void main()
{
char[] palindrome = cast(char[])"able was I ere I saw elba";
writeln(palindrome);
// ldc失败,dmd成功
writeln(palindrome.reverse);
}
不变=>变未定义行为.
浙公网安备 33010602011771号