On Tue, 23 Dec 2014 15:37:12 +0000 FrankLike via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> you will find the different: > D: PROCESSENTRY32* pe32 = > cast(PROCESSENTRY32*)GC.calloc(PROCESSENTRY32.sizeof); > > C++:PROCESSENTRY32 pe32; > > GC.calloc means: memset ?! do you see that shining star there? here it is, right in the end: `PROCESSENTRY32*`. and do you see that same star in C sample? jokes aside, it's dead simple: C code using stack-allocated struct (`PROCESSENTRY32` without an inderection) and D code using heap-allocated struct (`PROCESSENTRY32*` with indirection). hence C code using `memset()`, yet D code using `GC.calloc()`.
signature.asc
Description: PGP signature