摘要:
原文 应允许__traits(parameters)出现在函数的任何部分,而不仅仅是body和in和out合约中. 应允许如下: typeof(__traits(parameters))[0] f(Ts...)(Ts args) { ... } void f(Ts...)(Ts args) if ( 阅读全文
posted @ 2022-08-30 10:58
zjh6
阅读(27)
评论(0)
推荐(0)
摘要:
原文 dmd以下代码段错误,LDC无误. enum Test {A, B, C} Test test = Test.A; extern(C) void main() { switch(test) { default: break; } } 无法在Linux上使用dmd主分支重现,可能仅限于Windo 阅读全文
posted @ 2022-08-30 10:23
zjh6
阅读(16)
评论(0)
推荐(0)
摘要:
import std.stdio; import core.sync.rwmutex : ReadWriteMutex; enum PAGE_SIZE = 4096; alias PageId = uint; ubyte[] toBytes(uint value) { ubyte[] bytes = 阅读全文
posted @ 2022-08-30 10:04
zjh6
阅读(14)
评论(0)
推荐(0)
摘要:
原文 import std.array; import std.format; public class BinaryOperatorExpression { private { string operator; Expression firstExpr; Expression secondExpr 阅读全文
posted @ 2022-08-30 09:44
zjh6
阅读(22)
评论(0)
推荐(0)
摘要:
原文 struct std_string { std_string* ptr; ulong[3] data; this (ulong data) { this.data[] = data; this.ptr = &this;//这里 }//生命期不一致. this(const scope ref s 阅读全文
posted @ 2022-08-29 11:15
zjh6
阅读(34)
评论(0)
推荐(0)
摘要:
原文 class Bar { } class Foo { Bar get() { return new Bar; } alias get this; } void main() { auto foo = new Foo; void test(Bar delegate() dg) { assert(d 阅读全文
posted @ 2022-08-29 11:14
zjh6
阅读(14)
评论(0)
推荐(0)
摘要:
原文 gettext国际化包. Mathias 问题,dmd正在移动具有复制构造器的结构.导致了不能移植core.stdcpp.但是LDC和GDC按期望工作. d作者认为事情是因为,其中一个复制构造器正在传递右值,导致复制到栈上,而未更新内部指针. 建议进一步简化该示例,以确定问题. GDC行为是由 阅读全文
posted @ 2022-08-29 10:53
zjh6
阅读(19)
评论(0)
推荐(0)
摘要:
getcurpos()与cursor等位置函数,都要小心使用. fun! Zlgbp(p) "置列光标偏.偏移,p可为正或负" let [a,b,c,d,e]=getcurpos() let m=e+a:p "let m=e-1+a:p" "问题就在这里,这里一定要-1,不要问题找半天" "e-1是 阅读全文
posted @ 2022-08-28 22:01
zjh6
阅读(16)
评论(0)
推荐(0)
摘要:
原文 理想方法是让每个头文件都有自己的模块. 这几乎需要DMD合并C预处理器,对吧?因为这是可靠确定包含哪些标头的唯一方法. 最好方法是实现C23的带相同标签的相同类型是一样的,标签兼容规则的一些变体.导入到全局C命名空间表明,不能使用类型定义冲突的两个C标头.理想,使用D中的C应该比使用C中的C更 阅读全文
posted @ 2022-08-28 11:16
zjh6
阅读(17)
评论(0)
推荐(0)
摘要:
原文 @disablenew可禁止new符号,这样垃集就不会管理它,然后出现导致析构器/终结器混淆的麻烦.但它目前也禁止域. class A { @disable new(); } void main() { scope A a = new A(); } 禁止new的目的更多与管理生命期有关.与按特 阅读全文
posted @ 2022-08-28 10:38
zjh6
阅读(13)
评论(0)
推荐(0)
浙公网安备 33010602011771号