06 2022 档案

摘要:原文 enum counter(size_t x = [__traits(allMembers, mixin(__MODULE__))].length)=x; char[] member(ulong x) { char[] buf = "void[0] _X0000000000000000;".du 阅读全文
posted @ 2022-06-30 21:41 zjh6 阅读(9) 评论(0) 推荐(0) 编辑
摘要:1,函数声明位置放在使用之后. 2,(串&a)写成了(a)了. 3,忘记写中了. 4,子写成列了. 5,多移动了一步. 6,少写一个参数. 7,路径写成串了. 8,没有是文件函数,加上. 9,b写成a了. 阅读全文
posted @ 2022-06-30 17:20 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:0与1有两种表示意思,他们顺序不同,意思刚好相反. 1,0/1表示顺序,按顺序的,0为第1个,1为第2个,这是按顺序. 2,0/1表示真假,0为假,1为真.他们刚好容易造成歧义问题. 假设有a,b有项内容,如果按顺序,则是a为0,b为1.表示a是第1个,b是第2个. 而如果错误理解成按真假,则变成a 阅读全文
posted @ 2022-06-28 23:05 zjh6 阅读(111) 评论(0) 推荐(0) 编辑
摘要:构 位序串{ 元<整 I>静 空 后面(串&a,串&s){s=a.子串(I);} 元<极 位=0,整 P,整 Q>静 空 前面(串&a,串&s){ 如 常式(位){s=a.子串(P,Q);} 异{s=a.子串(P,Q-P);} } };//通过构中的模板函数来实现动作. 元<极 位=0,类 M,整 阅读全文
posted @ 2022-06-28 17:46 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:先是按递增序分串: 元<整 P> 空 序分串2(串&a,序列<P>,串&s){s=a.子串(P);} //这是最后一个. 元<整 P,整 Q,整...I,类 S,类...T> 空 序分串2(串&a,序列<P,Q,I...>b,S&s,T&...t){ s=a.子串(P,Q-P); 序分串2(a,序列 阅读全文
posted @ 2022-06-27 23:20 zjh6 阅读(22) 评论(0) 推荐(0) 编辑
摘要:原文 struct AppendTo(T) { private T[] *arr; this(return T[]* arr) { this.arr = arr; } void put(X)(X val) if (__traits(compiles, (*arr) ~= val)) { (*arr) 阅读全文
posted @ 2022-06-26 21:23 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:原文 可不用GC使用类.只需用malloc/free或std.experimental.allocator等等,手动分配和释放它们.automem的智能指针库对此很有用: automem 如果想完全避免D运行时,你不能使用"普通"的D类,但是extern(C++)类仍然可以工作. 如果你绝对必须使用 阅读全文
posted @ 2022-06-26 09:54 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:考虑普通局部变量: int foo = 0; 可分析为: Type_Name Local_Name Operator Initial_Value 考虑is表达式: is(typeof(func) Params == __parameters) 这样: is(Type_Name Local_Name 阅读全文
posted @ 2022-06-26 09:40 zjh6 阅读(40) 评论(0) 推荐(0) 编辑
摘要:原文 void main() { char accepted_type; char* non_accepted_type; if (__traits(isPointer, typeof(accepted_type))) { // 不接受类型 } else { /*不是指针,接受*/ } if (__ 阅读全文
posted @ 2022-06-26 09:06 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:简介 使用它,可避免微软的文件管理器,因为它会崩溃! Dirvish是极简目录查看器.转储路径列表到Vim缓冲区中并提供一些快捷键. 因为每个Dirvish缓冲区名都是字面目录路径,所以可:cd到目录, :cd % 创建新文件, :edit %/foo.txt expand()目录路径, :let 阅读全文
posted @ 2022-06-24 20:24 zjh6 阅读(83) 评论(0) 推荐(0) 编辑
摘要::command! -nargs=+ Fl :call Lxdm(<f-args>) "Fl表示显示联想函数.由中文关联的函数.1个或多个 :command! -nargs=1 Fn :call Xshs(<f-args>) "Fn表示显示函数. :command! -nargs=1 Fm :cal 阅读全文
posted @ 2022-06-24 16:41 zjh6 阅读(12) 评论(0) 推荐(0) 编辑
摘要:用C++写帮助函数,很爽. 你只需要: 1,先写C++函数的库,帮助包装函数. 2,再写C++函数的包装函数,然后用外(C),并导出dll.然后如下命令来编译: cl /EHsc /Zc:strictStrings- /LD @e:\\path\\cl额外链接 扩展.cxx 3,vim函数中如下: 阅读全文
posted @ 2022-06-24 14:42 zjh6 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#SingleInstance force ;防多次运行 If A_Hour Between 22 and 24 ;22点至24点 { 提醒器("222222","睡觉!") ;设定闹钟 } 提醒器(定时,提醒内容) { StringLeft,当前日期,A_Now,8 ;A_Now格式:年4位,月2 阅读全文
posted @ 2022-06-24 09:08 zjh6 阅读(62) 评论(0) 推荐(0) 编辑
摘要:原文 '\0'*10 没用,这样: import std.range; repeat("\0", 10).join(""); 或数组: char[] n; n.length = 10; n[] = '\0'; 阅读全文
posted @ 2022-06-24 08:55 zjh6 阅读(31) 评论(0) 推荐(0) 编辑
摘要:vim自身的历史命令好像有问题,我们自己备份一份. fun! Lsks() //"历史开始. let s:k=histnr("cmd") endf fun! Lsjs() //历史结束.文件中历史命令. //应该是打开文件前,取前后,历史命令,再全部加至`历史命令.vim`. let s:j=his 阅读全文
posted @ 2022-06-23 11:17 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 void main(){ template bar(){ void bar(int){} void bar(float){} } bar(1); bar(3.14); } 这真是个好主意. import std.stdio; void main() { template funcs() { v 阅读全文
posted @ 2022-06-22 21:14 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:1,处理行写成行处理了. 2,要这样写逆序: 静 常式 整 N=型长...(I); (((i+I+1==N)&&(G<I>(),0)),...); 3,调用G<I>(),不需要静态函数. 4,写模板类型时,要元<元<整>>,不能写成元<元<类>>. 看起来,这些都是小错误,可要发现他们不容易. 阅读全文
posted @ 2022-06-22 21:05 zjh6 阅读(9) 评论(0) 推荐(0) 编辑
摘要:看看,这种情况: 如(i){//i为0或1 动作<0>a;中; } 动作<1>a;//相反 是不是觉得很难看,借助简单的顺序/逆序启动来重构它: 元<元<整>类 G,整...I> 空 顺序启动(序列<I...>,整 i){ (((i==I)&&(G<I>(),0)),...); }//构也是函数. 阅读全文
posted @ 2022-06-22 18:19 zjh6 阅读(25) 评论(0) 推荐(0) 编辑
摘要:原文 DIP1000:现代系统编程语言中的内存安全 现代高级语言如D是内存安全的,可防止用户意外读写未用内存或破坏语言的类型系统.D的安全子集提供保证,用@safe来保证函数内存安全. @safe string getBeginning(immutable(char)* cString) { ret 阅读全文
posted @ 2022-06-22 15:14 zjh6 阅读(19) 评论(0) 推荐(0) 编辑
摘要:原文 void foo(void delegate() @system dg) @safe { int *bar; @system void corrupt() { bar = cast(int *)0xdeadbeef;} dg = &corrupt; // 可调用dg吗? }//dip1000都 阅读全文
posted @ 2022-06-22 09:03 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:原文 因为use包含destroy,所以不能为安全 R use(R, T)(T obj, R delegate(T) fT) { scope (exit) destroy!false(obj); return fT(obj); } 如何确保安全调用destroy? 只要调用它的析构器是@safe的, 阅读全文
posted @ 2022-06-22 09:02 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:原文 theFirstName[theFirstIndex].theSecondName[theSecondIndex].thirdName[theThirdIndex]=x; //你想改写为如下: alias shortName = theFirstName[theFirstIndex].theS 阅读全文
posted @ 2022-06-22 08:39 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:事件名意思BufNewFile开始编辑尚不存在文件BufReadPre开始编辑新缓冲区,读文件前BufRead开始编辑新缓冲区,读文件后BufReadPost开始编辑新缓冲区,读文件后BufReadCmd开始编辑新缓冲区前FileReadPre用":read"命令读文件前FileReadPost用" 阅读全文
posted @ 2022-06-21 20:58 zjh6 阅读(85) 评论(0) 推荐(0) 编辑
摘要:原文 结构可以是函子: private @safe struct TranslatableStringPlural { string _str, _strpl; this(string s1, string s2) { // 必须的! _str = s1; _strpl = s2; } string 阅读全文
posted @ 2022-06-21 10:52 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 struct TranslatedString { private string _str; string get() { return curLang.translate(_str); } alias get this; } template gettext(string str) { ve 阅读全文
posted @ 2022-06-20 22:53 zjh6 阅读(12) 评论(0) 推荐(0) 编辑
摘要:原文 利用D编译时传递格式串给允许用static this()运行时注册格式串的gettext,在version中包装条件,让编译器给你提取串. // File: lang.d version(extractStr) { int[string] allStrings; void main() { i 阅读全文
posted @ 2022-06-20 18:05 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:原文 我想包含特定模块时更改编译时数组,需要编译时知道数组值. 你可这样: static if (__traits(compiles, { import mymodule; })) { // 包含模块 enum compileTimeArray = ...; } else { // 不包含. enu 阅读全文
posted @ 2022-06-20 09:14 zjh6 阅读(7) 评论(0) 推荐(0) 编辑
摘要:构 A{ 串 a,b; 显 A(串&e){//有它后 a=e.子串(0,1); b=e.子串(0,2); } }; 空 主(){ 串 a{"ab"},b{"ac"}; A e{a,b}; } 这里,想用显 A(串&e)来单独从1个串来构造.但又想保留两个a,b来构造的能力,然而,没用! 编译不了,加 阅读全文
posted @ 2022-06-19 22:17 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:动&原=量引<串,0,类名>(); 空 动作(向量<串>&一){ 原=一; }//得到的就是引用. 通过这样,就可以避免如下: 空 动作(向量<串>&一){ 原=移动(一); ... 一=移动(原); } 更多信息见此 阅读全文
posted @ 2022-06-19 17:29 zjh6 阅读(6) 评论(0) 推荐(0) 编辑
摘要:fun! Xsml(n,ml,g='8') "新系命令,map,各种命令,都可放这里. "n为要显示的文件名. let i=execute(a:ml) let j=Zc(a:ml,0,4) let l=split(i,"\n") if j=="fun " let l=Qdq(l,3) endif " 阅读全文
posted @ 2022-06-19 15:51 zjh6 阅读(27) 评论(0) 推荐(0) 编辑
摘要:vim有些插件要求py.有时,明明安装好了py,就是好像有问题. 这里,64位机子,用的是32位的gvim及32位的py. 主要问题,就是说,找不到python39.dll, set pythonthreedll =f:\python\python310.dll //py相关配置要用set,不要有" 阅读全文
posted @ 2022-06-18 16:39 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:输入<Leader><Leader> w触发找单词, <Leader><Leader> fo,找o字母. let g:EasyMotion_verbose=0 let g:EasyMotion_leader_key=";f" //要背几个关键的.这个映射没映射好. //不要提示.自定义: map s 阅读全文
posted @ 2022-06-18 15:38 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 enum defaultClassConstructor = q{ this(typeof(this.tupleof) params) { static foreach(i;0..this.tupleof.length) { this.tupleof[i] = params[i]; } } } 阅读全文
posted @ 2022-06-17 08:54 zjh6 阅读(9) 评论(0) 推荐(0) 编辑
摘要:import std; void main() { string str = "abc123"; str[3..$].to!int.writeln; // 123 //str[3..4].to!int; auto bar = str[3].to!int; assert(bar == 49); // 阅读全文
posted @ 2022-06-16 16:20 zjh6 阅读(16) 评论(0) 推荐(0) 编辑
摘要:原文 import std.stdio; import std.range; auto next(Range)(Range r) { r.popFront; return r.front; } int main(string[] args) { auto i = iota(10); writeln( 阅读全文
posted @ 2022-06-16 09:20 zjh6 阅读(18) 评论(0) 推荐(0) 编辑
摘要:全屏的爽,那是非常爽的. 浏览器最上面那两条,是非常烦人的. 一般情况下,都可以借助vimium实现各种方便功能. 现在,再加上f6映射当前标签的复制网址功能, 你完全可以全屏了. f6映射 阅读全文
posted @ 2022-06-15 18:25 zjh6 阅读(15) 评论(0) 推荐(0) 编辑
摘要:复制网址(){ send {F11} sleep 100 send {F6}^c{esc} sleep 200 send {F11} sleep 100 click 787,255 ;用f11,复制网址,再休息下 ;这里在顶上某个地方再点了下,避免不能移动 } #IfWinActive ahk_cl 阅读全文
posted @ 2022-06-15 18:06 zjh6 阅读(23) 评论(0) 推荐(0) 编辑
摘要:原文 import std; template test(alias f) { auto test(I)(I i) { return f(i); } } void main() { alias t = test!(x=>x+1); 1.t.writeln; //<--不编译. 1.test!(x=> 阅读全文
posted @ 2022-06-15 15:03 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:原文 void delegate()[] dgs; foreach (immutable i; 0..3) { dgs ~= () => writeln(i); } foreach (dg; dgs) { dg(); // 输出2,2,2 } 你要这样: dgs ~= ( (n) => () { w 阅读全文
posted @ 2022-06-15 11:31 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:参考 #include <源位置> 元<类...T>构 日志{//必须改为源位置,不能用动. 日志(T...t,常 源位置&l=源位置::当前()){ 打印("文件:",l.文件名゛(),l.行(),l.列(),l.函数名()); 打印(t...); } }; 元<类...T>日志(T...)->日 阅读全文
posted @ 2022-06-15 09:50 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:原文 import std.typecons; import std.meta; Tuple!(int, int, int) iAMfunction() { return tuple(1, 2, 3); } extern(C) int main() {//-betterC int a, b, c; 阅读全文
posted @ 2022-06-14 11:37 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:原文 import std; struct ParseError { string msg; } alias ParseErrorOr(T) = SumType!(ParseError,T); auto parseErrorOr(T)(T x) { return ParseErrorOr!T(x); 阅读全文
posted @ 2022-06-14 09:44 zjh6 阅读(12) 评论(0) 推荐(0) 编辑
摘要:原文 void main() { int[] arr1 = [4, 9, 7]; int[] arr2 = [5, 2, 1, 10]; int[] arr3 = [6, 8, 3]; sort(chain(arr1, arr2, arr3)); //排序链. writefln("%s\n%s\n% 阅读全文
posted @ 2022-06-13 22:24 zjh6 阅读(17) 评论(0) 推荐(0) 编辑
摘要:原文 void appendLineOffset (int newofs) { auto optr = lineOffsets.ptr; lineOffsets ~= newofs; //检查运行时是否由于数组增长,而分配了新内存块 if (lineOffsets.ptr !is optr) { i 阅读全文
posted @ 2022-06-13 18:32 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:原文 上个月发布的2.100版本语言已完全删除旧重载符号.但是,使用D出色的元编程功能,可以编写插件模板,来让D1风格重载符号继续工作. 对比D1与D2重载符号 重载符号用来自定义(如+和-)操作符.在D1中,是用普通命名函数,如加法opAdd或乘法opMul.示例,用整来表示内部状态的结构类型: 阅读全文
posted @ 2022-06-13 18:13 zjh6 阅读(19) 评论(0) 推荐(0) 编辑
摘要:如下代码: module a; class Foo { private: int _c; } import b; void handle(Bar child) { child._c += child.c; } // module b; import a; class Bar : Foo { publ 阅读全文
posted @ 2022-06-13 17:34 zjh6 阅读(7) 评论(0) 推荐(0) 编辑
摘要:fun! Qjwth(d,c=' ') "这里都是区间外替换,区间内替换用g//,//s/ "d为c符分隔的串,默认为空格, "区间外替换.先是两个区间,然后是2个要替换词语. let[a,b,c,d]=Wmr(a:d,4,"Szw0",a:c) let sl=Sslg(a,b) "这里是区间外.这 阅读全文
posted @ 2022-06-13 15:50 zjh6 阅读(20) 评论(0) 推荐(0) 编辑
摘要:原文 这是我不久前提出的一个gensym实现: enum gensym = q{"_gensym" ~ __traits(identifier, {})["__lambda".length .. $]}; // 同行多次工作. pragma(msg, mixin(gensym)); pragma(m 阅读全文
posted @ 2022-06-13 09:57 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:原文 void main() { import std.algorithm, std.stdio; [1,2,3,4,5]. map!((x){ writeln("mapping ", x); return x; }). filter!(x=>x>2). front. writeln(); } ma 阅读全文
posted @ 2022-06-13 09:23 zjh6 阅读(15) 评论(0) 推荐(0) 编辑
摘要:#IfWinActive ahk_class Vim CapsLock::send {F7} RAlt::NumpadAdd RWin::NumpadSub AppsKey::NumpadMult RCtrl::NumpadDiv ;仅针对vim键,借助小键盘,来控制 ;<kPlus><kMinus 阅读全文
posted @ 2022-06-12 17:41 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:原文 import std.stdio; import std.format; struct indexedPair { size_t x, y; } struct MyArray { bool[3][3] elements; ref opIndex(indexedPair i) { return 阅读全文
posted @ 2022-06-12 10:10 zjh6 阅读(12) 评论(0) 推荐(0) 编辑
摘要:原文 可直接构造,不用先转为串: import std.digest.sha, std.bigint; ubyte[32] hash = sha256Of(whatever); auto t = BigInt(false, hash[]); // sign + magnitude 这样不行: aut 阅读全文
posted @ 2022-06-12 08:06 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 D的@nogc注解非常重要,但很少宣传. @nogc的主函数可编译时保证程序永远不会分配垃集内存. 从std.experimental.allocator这里分配. 这里的分配器可满足认为垃集不合适的,其他内存分配需求.通过I分配器接口,可运行时根据需要在垃集和自定义分配策略间切换. auto 阅读全文
posted @ 2022-06-11 23:40 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 1,用接口. D有匿名类,可内联定义它们,来简单包装函数列表来实现接口. 2,用闭包 是,语言打包的数据指针和函数.可取方法地址,从对象创建它们,也可从其他函数创建它们,或可用匿名函数内联定义它们.函数接受闭包,实现多态. 主要区别在,无需要共享的静态名. module a; void a(v 阅读全文
posted @ 2022-06-11 23:10 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:原文 import std.traits; // 从函数或闭包类型中转换`@nogc` auto assumeNoGC(T) (T t) if (isFunctionPointer!T || isDelegate!T) { enum attrs = functionAttributes!T | Fu 阅读全文
posted @ 2022-06-11 22:44 zjh6 阅读(14) 评论(0) 推荐(0) 编辑
摘要:原文 __gshared const TEST = import(`onlineapp.d`); extern(C) void main(){ __gshared bin_ptr = TEST.ptr; } 试试这个: __gshared bin_ptr; shared static this() 阅读全文
posted @ 2022-06-11 22:09 zjh6 阅读(12) 评论(0) 推荐(0) 编辑
摘要:fun! Ecpp(a,c=' ') let[a,b,c]=split(a:a,a:c) "分隔,分成3串,第1串为首条件,用单个符来分割 "第2串"二次匹配.f为函数名串,m为模式 let b=Wjxt(b,'"') let c=Wjxt(c,'"') let gs='%s/{}/\=TH(sub 阅读全文
posted @ 2022-06-11 11:12 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:原文 转换为可空: @safe Nullable!Item getItem(int _id) { import std.algorithm : filter; with (items.filter!(item => item.id == _id)) { if (empty) return Nulla 阅读全文
posted @ 2022-06-11 09:59 zjh6 阅读(8) 评论(0) 推荐(0) 编辑
摘要:import std; void main() { int[3] arr; arr.each!(e => e); // 编译 // arr.map!(e => e); // 失败 arr[].map!(e => e); // 编译 } 阅读全文
posted @ 2022-06-11 08:45 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:函数名中文名Asc升序AutoTrim自动修剪Block块BlockInput块输入Break断Catch抓Chr符Click点击ClipWait等待剪切板ComObjActive活动组对ComObjArray组对数组ComObjConnect连接组对ComObjCreate创建组对ComObjEr 阅读全文
posted @ 2022-06-10 14:50 zjh6 阅读(487) 评论(0) 推荐(0) 编辑
摘要:常用函数说明FileExist检查文件或目录是否存在,并返回其属性.GetKeyState如果按下指定键则返回真(1),如果按起则返回假(0).InStr从左侧或右侧搜索给定串(是否在串).RegExMatch判断串是否包含模式(正则式).RegExReplace替换串中出现的模式(正则式).Str 阅读全文
posted @ 2022-06-10 10:29 zjh6 阅读(178) 评论(0) 推荐(0) 编辑
摘要:原文 今天,我有一堆带有执行某些操作的参数的函数,我想通过程序的命令行向用户公开他们.此外,为了尽量方便用户,程序帮助文本应准确地描述每个函数(在命令行上被视为子命令)及每个函数带的参数. 当然,传统方法很简单:编写打印描述函数及其参数文本的showHelp()函数.然后在main()中为函数名编写 阅读全文
posted @ 2022-06-09 09:21 zjh6 阅读(17) 评论(0) 推荐(0) 编辑
摘要:原文 原: // mov rdx, <wordLen> *cast(char*)(code + 14) = 0x48; *cast(char*)(code + 15) = 0xC7; *cast(char*)(code + 16) = 0xC2; *cast(char*)(code + 17) = 阅读全文
posted @ 2022-06-09 08:16 zjh6 阅读(16) 评论(0) 推荐(0) 编辑
摘要:原文 class GCAllocated { float[] data; this() { // 非垃集分配字段 this.data = cast(float[])(core.stdc.stdlib.malloc(nBytes)[0 .. nBytes]); } } void foo() { aut 阅读全文
posted @ 2022-06-07 10:58 zjh6 阅读(36) 评论(0) 推荐(0) 编辑
摘要:import std.array; extern (C) void main() { auto numbersINeed = staticArray([1, 2, 3, 4, 5]); import std.range; import std.algorithm; import core.stdc. 阅读全文
posted @ 2022-06-07 09:56 zjh6 阅读(9) 评论(0) 推荐(0) 编辑
摘要:Atila 想默认启用-preview=nosharedaccess,由于同步而被阻塞.Max说他尝试在synchronized块去掉shared,但前端优化器去掉了该丢弃.Razvan提交了pr来修复,max给Walter说SIMD问题,Walter提交了 dmd的simd, Mathias 依赖 阅读全文
posted @ 2022-06-06 20:57 zjh6 阅读(11) 评论(0) 推荐(0) 编辑
摘要:快捷意思F1关于F2仅重命名Shift+F6仅重命名F3视图F4编辑F5复制F6重命名F7造目录F8删Shift+F8删F9跑完Alt+F8显示命令行历史Ctrl+Down显示命令行历史Ctrl+B平视图Ctrl+D目录热列表Ctrl+F快速过滤Ctrl+H目录历史Alt+Down目录历史Ctrl+ 阅读全文
posted @ 2022-06-05 22:53 zjh6 阅读(44) 评论(0) 推荐(0) 编辑
摘要:用vim代码简单替换py代码. fun! Vqjd() let a=getline('.') let a=TH(a,'+','') let a=TH(a,',','') let @*=a endf 原来版本是这样的: :silent!py3 import vim python3 << EOF imp 阅读全文
posted @ 2022-06-05 22:16 zjh6 阅读(41) 评论(0) 推荐(0) 编辑
摘要:原文 我不知道在单元测试块和合同中抓错误行为不一样. 一个反馈是非主线程.尽管都同意不应抓错误,但主线程会这样并打印文章中显示的有用输出. 如果允许主线程这样做,也应在非主线程做同样多(或更少)的事情.否则,无法跟踪线程. 如果偏执并想尽量少做,至少应复制串字面到stderr.类似"线程因错误退出" 阅读全文
posted @ 2022-06-05 14:45 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:原文 编程中,有内存安全概念,在一定程度上保证不会导致破坏内存.内存安全的极致是可机械验证不会破坏内存.来防护缓冲区溢出等攻击.D语言定义内存安全为:允许编写相当多有用代码,但保守禁止粗略的.实践中,编译器并不是万能的,它缺乏人类非常擅长,看到的环境,因此经常需要允许有风险的行为. 因为编译器在内存 阅读全文
posted @ 2022-06-05 10:38 zjh6 阅读(49) 评论(0) 推荐(0) 编辑
摘要:原文 dmd没问题,ldc的. 我有带声明的.di,及从它们生成存根函数和全局指针的单独模块: __gshared extern(C) static void* dpford_funcp_DMANGLE; pragma(mangle, "DMANGLE") void dpford_func_DMAN 阅读全文
posted @ 2022-06-05 09:17 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 import core.atomic,core.memory; private alias void delegate(Object) DEvent; private extern (C) void rt_attachDisposeEvent(Object h, DEvent e); priv 阅读全文
posted @ 2022-06-04 16:06 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:原文 这是简单的"事件总线"系统,其工作方式类似"信号",但更易使用. 程序员必须继承事件对象,并在其中定义如下所示必要属性: class EventChat : Event { string msg; this (ChatServer asrv, string amsg) { source = a 阅读全文
posted @ 2022-06-04 15:09 zjh6 阅读(29) 评论(0) 推荐(0) 编辑
摘要:原文 比较D中的异常和错误 什么是D中异常和错误?为什么有区别?为什么D认为可以在不抛函数内部抛错误? 抛可抛 简单地说,异常是在正常代码中不应出现的"异常"情况.异常优于其他类型的错误处理(如返回错误码或错误/值组合)的原因是:要处理异常.你不处理,别人就会处理.并且默认是打印出异常时的状态,然后 阅读全文
posted @ 2022-06-04 11:03 zjh6 阅读(71) 评论(0) 推荐(0) 编辑
摘要:原文 obj.addText( ForegroundColor.blue, TextFormat.underline,"链接", ForegroundColor.black, ~TextFormat.underline,"普通" ); 它通过变参模板和诸如ForegroundColor和Backgr 阅读全文
posted @ 2022-06-03 20:56 zjh6 阅读(18) 评论(0) 推荐(0) 编辑
摘要:原文 受Hana启发. 如果想实现找出包含类型的最大大小.在D中这很容易 import std.meta: AliasSeq; import std.traits: Largest; alias Types = AliasSeq!(int, float, char, double); enum ma 阅读全文
posted @ 2022-06-03 15:15 zjh6 阅读(21) 评论(0) 推荐(0) 编辑
摘要:可自定义d运行时来实现BC,标准运行时更加模块化,满足不了需求,可自定义运行时. 哦,不,只需创建叫object.d的文件,并添加它到构建中,覆盖正常的运行时,且/或可不链接默认运行时(dmd -defaultlib=yourfile.d).即使没有链接默认值,也最容易保存默认值,因为会自动按需生成 阅读全文
posted @ 2022-06-03 09:51 zjh6 阅读(16) 评论(0) 推荐(0) 编辑
摘要:原文 string str = "0123456789ABCDEF"; char[] chr = str.dup; assert(str.length == 16); assert(str.capacity == 0); import std.math: thus = nextPow2; //.al 阅读全文
posted @ 2022-06-03 09:23 zjh6 阅读(9) 评论(0) 推荐(0) 编辑
摘要:原文 public import std.complex; public interface Mtype { // ... } public class Number : Mtype { public: this(Complex!realnum=Complex!real(0,0)) shared / 阅读全文
posted @ 2022-06-02 14:54 zjh6 阅读(13) 评论(0) 推荐(0) 编辑
摘要:1,资源.cpp要与主.cpp等源码对应,不要搞混了. 2,标头.cpp,这次有点特殊,里面加了几个类. 3,对话.cpp,这个最主要的,主类为C主框,一直在报{不匹配,最终找到,原来是尾映消未正确映射(非常重要,下次就知道原因了), 而,开映消同样有问题,因为力量不够,要改为开映消扩,否则,要崩溃 阅读全文
posted @ 2022-06-02 10:27 zjh6 阅读(9) 评论(0) 推荐(0) 编辑
摘要:原文 void main() { import std.stdio : writeln; import core.thread; // 用`-O`导致死循环. writeln("Starting..."); bool done = false; // 使它`shared`,但不工作 //用`共享/g 阅读全文
posted @ 2022-06-02 09:23 zjh6 阅读(10) 评论(0) 推荐(0) 编辑
摘要:原文 我想在执行算法时,后台运行程序,并要知道程序的pid来结束它. executeShell("(sleep 10000 && echo \"SLEEP\" >> log) &");//长期程序 while (!interrupted) { //执行算法 executeShell("(echo \ 阅读全文
posted @ 2022-06-01 08:40 zjh6 阅读(18) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示