小编bab*_*u67的帖子

为什么在Linux64下使用.ptr修补字符串失败但在Win32下没有?

为什么下面的小样本在Linux64下失败但在Windows32下失败?

module test;

import std.string, std.stdio;

void main(string[] args)
{
    string a = "abcd=1234";
    auto b = &a;
    auto Index = indexOf(*b, '=');

    if (Index != -1)
        *cast (char*) (b.ptr + Index) = '#';

    writeln(*b);
    readln;
}
Run Code Online (Sandbox Code Playgroud)

string portability pointers d

3
推荐指数
1
解决办法
120
查看次数

标签 统计

d ×1

pointers ×1

portability ×1

string ×1