D as a Better C

Azi Hassan via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Aug 30 15:22:23 PDT 2017


How should command-line arguments be used in better C ? Looping 
through argv seems to print environment variables :

import core.stdc.stdio;

extern(C) int main(int argc, char*[] argv, char*[] env)
{
	foreach(i; 0 .. argc)
		printf("arg %d: %s\n", i, argv[i]);
	return 0;
}


Compiling with v2.076.0-b2-dirty on Lubuntu 14.04 and running 
with one argument outputs the following :

arg 0: XDG_VTNR=7
arg 1: LC_PAPER=fr_FR.UTF-8


More information about the Digitalmars-d-announce mailing list