According to the documentation, readf is supposed to return a uint. But even this simple example fails to compile:
hello.d
import std.stdio;
void main() {
int x;
uint r = readf("%s", &x);
}
error message:
hello.d(5): Error: expression…
I was recently looking into the details of literals in the D programming language.
Because octal literals use 0 as prefix to the numbers, int x = 078; is invalid naturally. But then why int x = 08; is valid in DMD?
However, I have tested the same…
I'm having a heck of a time trying to get the barrier sync in D to work properly. I'm currently not getting any compiler errors, however every time it reaches the barrier I get a segmentation fault. Here's basically what I have:
import…
I'm trying to make an interop with C++ and D. And the thing I've found today is really messing my mind: objects are not being passed correctly in my program.
It's better to show an example.
I have a C++ library, which I compile to an object file…
Unfortunately I cannot seem to reproduce this behavior in a minimal working example, so this may be too vague. However, I can at least state what is not causing the behavior.
I have a D module containing several classes with unit tests, with…
I've tried to statically link with sqlite3 without success. I'm using the 'etc.c.sqlite3' header, and the sqlite3 amalgamation. To create the .lib file I've tried both VC++ and MinGW-gcc, both of these compile the source file successfully - but they…
I'm having trouble instantiating a RedBlackTree container with chars, but it works with ints:
import std.stdio;
import std.container;
void main()
{
auto r1 = redBlackTree!(int)(); // works
auto r2 = redBlackTree!(char)(); //…
How the implementation of the struct in the D language to ubyte [] or ubyte [] to the struct, please brothers help answer this question, thank you!
If a struct contains the string or char [] what to do?
For example, such a structure:
struct…
What is the recomended way to remove white space from a char[] in D. for example using dmd 2.057 I have,
import std.stdio;
import std.string;
import std.algorithm;
char[] line;
int main(){
line = r"this is a line with spaces ";
line =…
I want to load Win32 API functions using Runtime.loadLibrary and GetProcAddress(...). Using mixin:
template GetProcA(alias func, alias name_in_DLL)
{
const char[] GetProcA = func ~ ` = cast(typeof(`~func~`))…
Linking the following two files gives me a link-error:
a.d:
import std.stdio;
extern string test ();
void main() {
writeln(test());
readln();
}
b.d:
string test () {
return "hello";
}
the error I get is:
Error 42: Symbol Undefined…
I've recently installed Fedora 16 (which is great), mostly because I wanted to try LDC2 but also because Gnome Shell runs much smoother on Fedora than Ubuntu 11.10 (at least on my hardware).
LDC2 works great, but I'm wondering if, by outputting LLVM…
I have two files: Main.d and ImportMe.d. Their purposes should be self-explanatory. They are in the same directory, and have no explicit module declaration. When I try to compile Main.d, though, I get a "symbols not found" error!
$ dmd Main.d…