BCS Wrote:
> I need a function that works like the following:
>
> > T* New(T)() { return new T; }
>
> But that also works with static arrays:
>
> > auto i = New!(int)();
> > auto a = New!(int[27])();
>
> The cleanest solution I can think of is:
>
> > T* New(T)() { return (new T[1]).ptr; }
>
sybrandy Wrote:
> All,
>
> Does anyone know where I can get a simple example of writing a server in
> D? Just a stupid little echo server would be fine. I'm trying to write
> one myself, but for some reason it doesn't seem to be accepting any
> connections. I figure it's something stupidly
Funog Wrote:
> Is it possible to run an external .exe and have access to its standard
> input/output? Apparently std.process does not allow this.
>
You can try loading the .exe into memory as a library (dll) and passing the
.exe's entry point (main) to a thread (core.thread.Thread). Just a ran
strtr Wrote:
> or: Why does dmd keep on crashing on my code :)
> (I blame it on the average D programming; they don't write enough crappy code
> )
>
> After reading the -w post I tried using the -w switch again and it also
> prevents me from seeing all my warning, but for a different reason :
>
> The buffer you are passing to receive is 0 bytes long. The
> std.socket.Socket.receive function is a wrapper over the normal socket
> function, and includes a test for an empty buffer.
>
> Daniel
Ohh, I see. Thank you!
I thought that the function would resize the buffer accordingly. Than
Tomek SowiÅski Wrote:
> Dnia 31-01-2010 o 21:39:21 Ali Ãehreli napisaÅ(a):
>
> > � wrote:
> >> Dnia 31-01-2010 o 20:59:47 Tomek Sowi�ski napisa�(a):
> >>
> >>> // specialization needed to limit matching types
> >>> void print(T:int)(T thing)
> >> To be clear -- I did this to silence t
> It works with dmd 2.040 without the :int specialization.
No it doesnt. Did you use specific compiler flags? Also check that you are
using the source I posted and not the modified versions presented which served
only to circumvent compiler warnings and not answer the original question: is
it a
y whether this belongs in bugzilla or not. It might.
>
> On 01/31/2010 12:49 PM, daoryn wrote:
>
> >
> > I expected it to output "calling print(T[])" on the second "print". Would
> > this be a bug or did I misunderstand the template specialization?
Daniel Murphy Wrote:
> daoryn Wrote:
>
> > According to http://digitalmars.com/d/2.0/template.html it is possible to
> > specify template specialization so that DMD prefers them when instanciating
> > templates, ho
According to http://digitalmars.com/d/2.0/template.html it is possible to
specify template specialization so that DMD prefers them when instanciating
templates, however the following code:
-
import std.stdio;
void print(T)(T thing)
{
writeln("Calling pri
In Phobos D1 the functions we have the functions "suspend" and "resume",
however, these functions seem to be gone on Phobos D2. Is there any particular
reason why this functionality has been removed? What other ways do I have to
pause/resume a specific thread?
11 matches
Mail list logo