上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 259 下一页
摘要: 原文 代码在此 输出: Processing: module main Processing: module object Processing: module c Processing: module attr test2() has sillyWalk main() has sillyWalk 阅读全文
posted @ 2022-10-15 15:04 zjh6 阅读(22) 评论(0) 推荐(0)
摘要: 原文 ldc支持gdc风格汇编 avrd d的avr 有两个选项可链接ldc发出的编译目标文件:用avr-gcc的链接器,或用llvm的内部链接器.-gcc=avr-gcc参数告诉在哪查找avr-gcc工具,或可用使用llvm的内置链接器的--link-internally.两者都会起作用. 使用- 阅读全文
posted @ 2022-10-15 14:32 zjh6 阅读(56) 评论(0) 推荐(0)
摘要: struct Operator(alias fn, string operator = "/") { static auto opBinaryRight(string op : operator, T...)(T value1) { struct Result { auto opBinary(str 阅读全文
posted @ 2022-10-15 08:53 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: 原文 下载地址 在ImportC之前,翻译glfw-d和libsoundio-d来帮助翻译的工具. 1库,2库. 用树解析器帮助解析包括预处理器指令的.c或.h文件,然后在需要时,用大致等效的D模式替换C语法模式. 示例: #include <stdio.h> #define TAU 6.28318 阅读全文
posted @ 2022-10-14 09:06 zjh6 阅读(23) 评论(0) 推荐(0)
摘要: struct X { Y y; ref Y getY() return { return y; } } 告诉编译器getY()返回基于隐式"this"引用的引用.它现在可用(DIP25是它的提议). 现在正在实现增加了支持指针值的DIP1000(DIP25只处理引用).实际效果: alias Y = 阅读全文
posted @ 2022-10-13 19:53 zjh6 阅读(12) 评论(0) 推荐(0)
摘要: DonClugston最先发现的.假设我有带成员函数的结构: struct S { int s; pure void set(int i) { s = i; } 现在,即使在强纯函数中,我也可以使用弱纯函数,即使它通过参数改变状态: pure int foo(int i) { S s; s.set( 阅读全文
posted @ 2022-10-11 22:39 zjh6 阅读(21) 评论(0) 推荐(0)
摘要: dmdD编译器有内置覆盖分析器: |bool foo(bool i, bool j) { 2| return i || 1| j; |} | |void main() { 1| foo(true, false); 1| foo(false, false); |} 它计数每条语句,并将逻辑表达式操作计 阅读全文
posted @ 2022-10-11 22:08 zjh6 阅读(20) 评论(0) 推荐(0)
摘要: int *_memset32(int *p, int value, size_t count) { asm { mov EDI,p ; mov EAX,value ; mov ECX,count ; mov EDX,EDI ; rep ; stosd ; mov EAX,EDX ; } } 编译器为 阅读全文
posted @ 2022-10-11 16:46 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: 原文 上一篇文章显示了如何用新的DIP1000规则让切片和指针内存安全的引用栈.但是D也可其他方式引用栈. 面向对象实例 前面说过,如果了解DIP1000如何同指针工作,那么就会了解它如何同类工作.示例: @safe Object ifNull(return 域 Object a, return 域 阅读全文
posted @ 2022-10-10 20:31 zjh6 阅读(49) 评论(0) 推荐(0)
摘要: 原文 ref int f(ref return scope int* p) @safe { return *p; } 按引用+中域编译,保护p值,而非p地址,成功编译,因为p就是返回值. 而: ref int f(ref scope return int* p) @safe { return *p; 阅读全文
posted @ 2022-10-09 15:10 zjh6 阅读(23) 评论(0) 推荐(0)
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 259 下一页