d

The D Programming Language for Game Development [closed]

半腔热情 提交于 2019-12-03 00:22:05
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 9 months ago . Recently I've been bothered because I reached a point in which C++ (even 0x) felt very limited, so I started looking for alternatives. Forget Java, C#, Python or Ruby. I still like the low-level nature of C++ and I'm not fond of virtual machines. Further, I'm a game engine

How to create/write a simple XML parser from scratch?

爱⌒轻易说出口 提交于 2019-12-02 23:56:24
How to create/write a simple XML parser from scratch? Rather than code samples, I want to know what are the simplified, basic steps in English. How is a good parser designed? I understand that regex should not be used in a parser, but how much is regex's role in parsing XML? What is the recommended data structure to use? Should I use linked lists to store and retrieve nodes, attributes, and values? I want to learn how to create an XML parser so that I can write one in D programming language. If you don't know how to write a parser, then you need to do some reading. Get hold of any book on

nginx, fastcgi and open sockets

喜你入骨 提交于 2019-12-02 23:36:41
I'm experimenting using fastcgi on nginx, but I've run into some problems. Nginx doesn't reuse connections, it gives 0 in BeginRequest flags, so the application should close the connection after the request has finished. I have the following code for closing: socket.shutdown(SocketShutdown.BOTH); socket.close(); The problem is that the connections are not actually closed.. They linger on as TIME_WAIT, and nginx (or something) wont't keep opening new connections. My guess is I'm doing something wrong when closing the sockets, but I don't know what.. On a related note - how can I get nginx to

Does the D language have multiple standard libraries and issues with GC?

隐身守侯 提交于 2019-12-02 20:00:24
I'm wondering how mature and stable D is, and if it might be a good replacement for C/C++. I know that there are currently two standard libraries (Phobos and Tango). Is it still the case that there is no unified standard library? Additionally I heard some time ago that the languages has problems on the boundaries of GCed/non-GCed code. I couldn't find any reference about that on the D website, so is this problem still true? Version 1 of D is mature and stable, and there are definitely folks who use it for real work. Phobos is the only standard library that D has ever had or likely ever will

What is a “yield return” equivalent in the D programming language?

时光怂恿深爱的人放手 提交于 2019-12-02 18:04:05
Here is a simple generator in C#. IEnumerable<int> Foo() { int a = 1, b = 1; while(true) { yield return b; int temp = a + b; a = b; b = temp; } } How do I write a similar generator in Digital Mars D? (The question is about the yield return statement) Thanks! Update. That's interesting. Since I'm just generating a mathematical sequence, using recurrence may be a good option. auto fib = recurrence!("a[n-1] + a[n-2]")(1, 1); foreach (e; take(fib, 10)) // <- prints first ten numbers from the sequence { writeln(e); } There's no exact equivalent in D. Here are some rough equivalents: Using opApply

DMD vs. GDC vs. LDC

主宰稳场 提交于 2019-12-02 17:51:02
What are the Pros/Cons of the different D Compilers? How is the performance and the standard compliance/D2 support? How well are debuggers supported? How good are the Error messages and is the IDE integration? How good is the 64 bit support? My thought so far: DMD Mature and well maintained Only one platform, 64 bit support is not good Not FOSS GDC Supports various platforms Has very mature optimizations, so it's fast? Out of date runtime? GCC so a good debugger support? LDC Supports various platforms LLVM, so it supports JITing? Has very mature optimizations, so it's fast? Not very well

D programming without the garbage collector

一笑奈何 提交于 2019-12-02 16:34:55
I've been looking at D today and on the surface it looks quite amazing. I like how it includes many higher level constructs directly in the language so silly hacks or terse methods don't have to be used. One thing that really worries me if the GC. I know this is a big issues and have read many discussions about it. My own simple tests sprouted from a question here shows that the GC is extremely slow. Over 10 times slower than straight C++ doing the same thing. (obviously the test does not directly convert into real world but the performance hit is extreme and would slow down real world happens

Metaprogramming in C++ and in D

随声附和 提交于 2019-12-02 16:20:46
The template mechanism in C++ only accidentally became useful for template metaprogramming. On the other hand, D's was designed specifically to facilitate this. And apparently it's even easier to understand (or so I've heard). I've no experience with D, but I'm curious, what is it that you can do in D and you cannot in C++, when it comes to template metaprogramming? Jonathan M Davis The two biggest things that help template metaprogramming in D are template constraints and static if - both of which C++ could theoretically add and which would benefit it greatly. Template constraints allow you

Turning off the D garbage collector

房东的猫 提交于 2019-12-02 16:18:13
I'm a C++ programmer thats considering using D for a personal project I want to play around with. I was wondering if there's a way to completely disable the garbage collector, and what the risks are of doing so. I know I can manage my own memory by overriding new and delete to use malloc and free, but if I did that I'd rather the garbage collector not run at all. To turn off the GC in D2: import core.memory; void main(string[] args) { GC.disable; // Do stuff. } If using D1/Phobos: import std.gc; void main(char[][] args) { std.gc.disable; // Do stuff. } In D1/Tango: import tango.core.Memory;

Why is thread local storage so slow?

ぃ、小莉子 提交于 2019-12-02 15:09:14
I'm working on a custom mark-release style memory allocator for the D programming language that works by allocating from thread-local regions. It seems that the thread local storage bottleneck is causing a huge (~50%) slowdown in allocating memory from these regions compared to an otherwise identical single threaded version of the code, even after designing my code to have only one TLS lookup per allocation/deallocation. This is based on allocating/freeing memory a large number of times in a loop, and I'm trying to figure out if it's an artifact of my benchmarking method. My understanding is