![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
D语言编程
炼气散人
等儿子高考后,或许会回来
展开
-
D语言用GDB调试
GDB7.2后开始支持对D语言的调试,前提是必须用DMD编译时打开一个开关。接着上例,编译命令修改为:dmd -gc -debug hello.d然后就可以用正常的gdb命令调试了:gdb hellob hello.d:5run在Emacs里面用gdb模式调试,和C++一样方便了。原创 2012-02-22 19:48:19 · 3421 阅读 · 0 评论 -
D 语言编写CGI程序
编写main.d,内容如下:import arsd.cgi; void yourFunction(Cgi cgi) { cgi.write("Hello, world!"); } mixin GenericMain!yourFunction;从下面的网站下载cgi.d文件,放在main.d同一个目录下https://github.com/adamdruppe/misc-stuff-i原创 2012-02-23 23:41:41 · 4736 阅读 · 0 评论 -
D语言unit test
参考文档http://dlang.org/unittest.html但是要注意几点,至少需要提供一个main函数编译时用-unittest参数运行时只有测试失败才会输出一堆信息。不过这些信息显然和输出测试报告相距甚远。比如我的main.d文件:module hello;import std.stdio;void main(){ writeln("unit test!");}sum原创 2012-02-26 12:09:57 · 3377 阅读 · 0 评论 -
D语言容器使用
先来一个简单的例子:module testContainer;import std.stdio;import std.container;void main(){ SList!int myList; foreach(i;0..10){ myList.insert(i); } foreach(element;myList){ writeln(elem原创 2012-02-25 15:05:02 · 3568 阅读 · 2 评论 -
D语言泛型
比C++容易的泛型。看看下面简单的例子:module testContainer;import std.stdio;import std.container;void main(){SList!int myList;foreach(i;0..10){myList.insert(i);}foreach(element;myList){writeln(element);}}现在来原创 2012-02-29 13:38:04 · 3306 阅读 · 1 评论 -
Ubuntu下用Emacs编写D语言程序
一个很简单的程序,Hello,world1.下载d-mode.elhttp://prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode2.放到自己的目录下,比如我的/opt/emacs_plugins目录,然后在.emacs文件中配置一下:(load-file (expand-file-name "/opt/emacs_plugins/d-mo原创 2012-02-19 23:41:35 · 4257 阅读 · 0 评论