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?
(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
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.
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
Your answers are remarkable elaborated. Thanks for your great effort,
Jonathan!! ;-)
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
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
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?
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 =
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;
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;
}
---
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!
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
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);
}
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?
15 matches
Mail list logo