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);
}

不变=>变未定义行为.

posted @ 2022-02-03 10:12  zjh6  阅读(21)  评论(0)    收藏  举报  来源