摘要:
原文 struct S { int m(int x) {return x;} } void main() { int function(int) func = &S.m; writeln(func(5));// 不打印5! } 不应编译. 我一直在研究该问题,似乎,令人惊讶的是,这是期望行为.我先修 阅读全文
posted @ 2022-12-06 10:34
zjh6
阅读(20)
评论(0)
推荐(0)
摘要:
原文 '%e'(指数)如下说明: e:根据以下规则打印的浮点参数: 1,小数点前的一位数 2,如果精度不为零,则返回小数点 小数点后所需位数,按精度(默认精度为6)确定. 精度,意思是小数点后打印多少位.如果用%e打印: enum f = 1.23456789; writefln!"%e"(f); 阅读全文
posted @ 2022-12-06 10:16
zjh6
阅读(19)
评论(0)
推荐(0)
摘要:
原文 如下在ldc的更好C下编译: import core.stdc.stdio; import core.stdc.stdlib; struct MemoryBlock { char* ptr; ulong length; } void* ptr = cast(void*)0x7a7; void* 阅读全文
posted @ 2022-12-06 10:02
zjh6
阅读(28)
评论(0)
推荐(0)
摘要:
原文 pragma(crt_constructor)应改进为: 1.设置默认extern"C" 2.允许修改不变变量. crt_destructor同样,因为可修改可变变量,该构造器还应标记为@system. 链接 重复一遍: 1,crt_constructors可修改不变. 2,因为1,标记crt 阅读全文
posted @ 2022-12-03 09:47
zjh6
阅读(15)
评论(0)
推荐(0)
摘要:
原文 class X { this() { assert(false);// } int x = 3; } 在X中,我不能添加或更改方法. 编译时,如果有X和"x"字段名,我如何获得3,对构,可: X.init.x //或 __traits(getMember, X.init, "x") 工作.但对 阅读全文
posted @ 2022-12-02 15:29
zjh6
阅读(19)
评论(0)
推荐(0)
摘要:
原文 是否可用一条语句来编写创建初化浮数组的void指针? float* arr = cast(float*) new float[4]; arr[0] = 0.1; arr[1] = 0.1; arr[2] = 0.1; arr[3] = 0.1; void* value = cast(void* 阅读全文
posted @ 2022-12-01 10:00
zjh6
阅读(18)
评论(0)
推荐(0)
浙公网安备 33010602011771号