上一页 1 ··· 84 85 86 87 88 89 90 91 92 ··· 259 下一页
摘要: 当前的微软80位模拟器不支持80位到浮/双精的转换.自己写,工作量太大,细节多,网上没有boost许可模拟器. 可在std.conv中加narrow函数. 指令集改变不大. import std.conv, std.range, std.stdio; void main() { writeln(io 阅读全文
posted @ 2022-02-18 09:46 zjh6 阅读(30) 评论(0) 推荐(0)
摘要: struct Module { CachedString data; } struct CachedString { private size_t len; this (string data) { this.len = data.length; } public string str () con 阅读全文
posted @ 2022-02-18 08:54 zjh6 阅读(13) 评论(0) 推荐(0)
摘要: struct S { @disable this() immutable;//注解 } void main() { S s; } 当不能访问构造器时,加不加不变都一样,编译器在此,都没看限定符. 阅读全文
posted @ 2022-02-17 20:34 zjh6 阅读(10) 评论(0) 推荐(0)
摘要: 过去如下代码,第二条消息发送到标准输出之后抛ConvException.现在,第2条不显示.输出已刷新,但在输出异常后. import std.stdio; void main() { int a; write("请输入整:"); readf("%s", &a); int b; write("请输入 阅读全文
posted @ 2022-02-17 20:19 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: void main() @safe { char[4] message = "oops"; assert(0, message[]); } 单独编译,并出错,但用-preview=dip1000可以避免. dip1000将是默认,因而不算八哥. struct S { int i; int* ptr; 阅读全文
posted @ 2022-02-17 14:54 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: 原文 void foo(){} struct A{ auto opDispatch(string op)() { writeln;//故意,不导入. } } void test(){ A.init.foo(); } //dmd -c -o- main.d 当opDispatch不编译时,发生.正确行 阅读全文
posted @ 2022-02-17 10:31 zjh6 阅读(17) 评论(0) 推荐(0)
摘要: 原文 module test; @safe: import std; void main() { //import std.uni : isWhite; //需要取消注释,才能编译. writeln("学D有趣".split!isWhite); } isWhite有歧义,有std.uni.isWhi 阅读全文
posted @ 2022-02-17 09:40 zjh6 阅读(13) 评论(0) 推荐(0)
摘要: struct DontDoThis { immutable char[12] content; @safe this(char ch) { content[] = ch; throw new Exception(content[]); // assert(0, content[]);//也能触发 } 阅读全文
posted @ 2022-02-17 09:28 zjh6 阅读(16) 评论(0) 推荐(0)
摘要: #include <常用> #include "碰碰2.cpp" #include "p.cpp" 元<类...T>构 启动{ //有T,有I,有J,基本上就简单了. 元<元<类...>类 G,整...I,整...J> 静 空 动作(序列<I...>a,序列<J...>b){ 常式 动 e=相转绝( 阅读全文
posted @ 2022-02-16 17:06 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: 构 AA{ 空 f(){ 打印("AA"); } }; 构 AB{ 空 f(){ 打印("AB"); } }; 构 BA{ 空 h(){ 打印("BA"); } }; 构 BB{ 空 h(){ 打印("BB"); } }; 构 BC{ 空 h(){ 打印("BC"); } }; 构 CA{ 空 g( 阅读全文
posted @ 2022-02-16 17:03 zjh6 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 84 85 86 87 88 89 90 91 92 ··· 259 下一页