D as a Better C

Adam D. Ruppe via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Aug 30 15:48:45 PDT 2017


On Wednesday, 30 August 2017 at 22:22:23 UTC, Azi Hassan wrote:
> extern(C) int main(int argc, char*[] argv, char*[] env)

That's a D array of pointers. A D array is larger than a C 
"array" argument, thus you're skipping past it.

The correct declaration is (int argc, char** argv, char** env).

(I'd argue that is the correct way to write it in C too, that's 
how I always do and it works there. But I just loathe C's arrays 
anyway.)


More information about the Digitalmars-d-announce mailing list