Dup'ing an array onto the stack

Tom S h3r3tic at remove.mat.uni.torun.pl
Fri Feb 24 16:43:48 PST 2006


John Demme wrote:
> But it's a lie, since stackStr is stored on the heap.  How do I get it on
> the stack?  I can easily get the space on the stack for it using alloca(),
> but how do I tell the array to use a certain place in memory?

How about:

char[] foo = (cast(char*)alloca(...))[0 .. bar.length];
foo[] = bar[];

?


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O 
!M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y
------END GEEK CODE BLOCK------

Tomasz Stachowiak  /+ a.k.a. h3r3tic +/



More information about the Digitalmars-d-learn mailing list