Re: ptrace (process trace system call) on Linux from D

2012-04-25 Thread mta`chrono
Am 25.04.2012 18:36, schrieb Matej Nanut: Hello everyone, I would like to know how to call ptrace (the system call) from D. I don't know what to import or link. If my understanding is correct, I need to create a .di file of some sort with stuff declared in it. How would I do this?

Re: ptrace (process trace system call) on Linux from D

2012-05-07 Thread mta`chrono
(2) Is it more D-ish to use something like enum PTRequest { traceMe = 0, ... } instead of the fully capitalised originals? It doesn't seem to affect the working of things. Yes, that's more D-ish. In new D code I prefer the camelcased ones, but there are cases where you'd like to use the

Re: foreach_reverse error

2012-05-11 Thread mta`chrono
group returns a lazy forward range. use foreach(i; group(retro(ints))) Yet another reason foreach_reverse needs to go. T No please don't! There are hundred and ten very usefull cases.

why is string not implicit convertable to const(char*) ?

2012-06-29 Thread mta`chrono
does anyone know why string not implicit convertable to const(char*) ? --- import core.sys.posix.unistd; void main() { // ok unlink(foo.txt); // failed string file = bar.txt; unlink(file); } test.d(10): Error: function core.sys.posix.unistd.unlink

Re: why is string not implicit convertable to const(char*) ?

2012-07-02 Thread mta`chrono
Your answers are remarkable elaborated. Thanks for your great effort, Jonathan!! ;-)

Re: deimos libX11 undefined reference

2012-07-12 Thread mta`chrono
Am 12.07.2012 08:17, schrieb Jacob Carlborg: On 2012-07-12 01:50, cal wrote: Hmm, looking at the .c header, the function is not even defined. I think it is not used, and in this case turning macros into functions in the binding generates linker errors. I don't know the best way to fix this

Re: What is shared functions?

2011-10-26 Thread mta`chrono
void main() { shared s1 = cast(shared)new S(); s1.onlyShared(); // ok //s1.notShared(); // error: not callable using argument types () shared auto s2 = new S(); //s2.onlyShared(); // error: not callable using argument types () s2.notShared(); // ok } I would rather

Re: DFastCGI

2011-11-23 Thread mta`chrono
IIRC there are two version of fastcgi / fgci ? The one is using stdin, stdout for communication and the application is running as a child of the webserver. And the other is running as a standalone application using unix sockets for communcation. Is DFastCGI able to handle both?

Re: auto

2011-11-26 Thread mta`chrono
Did you know that auto is not auto in the way auto behalfs. it's just a placeholder so the compiler can determine that a variable follows. but you can use any other keyword for type interfering, too. void main() { const a = FunctionThatReturnsSomething(); static b = 5.0; scope c =

Re: dup method const or not?

2011-11-27 Thread mta`chrono
that's a real good question. it fails with the following error: Error: function std.bitmanip.BitArray.dup () is not callable using argument types () const here is a hack: --- import std.bitmanip; import core.stdc.string; void main() { const(BitArray) foo; BitArray bar;

Re: dup method const or not?

2011-11-28 Thread mta`chrono
Okay, what about this hack? --- import std.bitmanip; import core.stdc.string; void main() { const(BitArray) foo; BitArray bar; bar.len = foo.len; bar.ptr = foo.ptr[0 .. foo.dim].dup.ptr; } ---

Re: Restrict access to critical functions

2011-12-14 Thread mta`chrono
Maybe you should use a VM to run your restricted applications. Or have a look a chroot, dchroot or schroot, to setup such stuff. The Programming Language will not help you in this case!

Re: newbie question: Can D do this?

2011-12-21 Thread mta`chrono
In PHP frameworks often use $option arrays which are some kind of key value pairs. they are merged with the default valuzes inside the function. pro: - you can pass an argument by name - you only need to pass those who needed. cons: - hash arrays it should be possible to create a similar

Re: char* to long

2012-01-24 Thread mta`chrono
Why not just go the good old way? you char* should be zero terminated when coming from c. private import core.stdc.stdlib, std.stdio; void main() { const(char)* str = 1234567890.ptr; long lng = atoll(str); writeln(lng); }

Re: Does D supply basic error codes?

2012-01-29 Thread mta`chrono
import core.stdc.stdlib; int main() { return EXIT_FAILURE; // EXIT_SUCCESS works here too. } Am 30.01.2012 00:21, schrieb NewName: Hello all. C has EXIT_FAILURE and EXIT_SUCCESS to be returned from main(). Does D have similar predefined values?