string not aliased

Witold Baryluk baryluk at smp.if.uj.edu.pl
Wed Aug 15 09:29:44 PDT 2007


Dnia Wed, 15 Aug 2007 18:24:19 +0200
chbrosso at free.fr (Charles Brossollet) napisał/a:

> Hi all,
> 
> I'm a complete newbie to D, and tried the examples on the Wikipedia
> page. the example 2 shows a main function like this:
> 
> int main(string[] args)   // string is a type alias for const(char)[]
> 
> But, I get this error on compile:
> hello.d:3: Error: identifier 'string' is not defined
> hello.d:3: Error: string is used as a type
> hello.d:3: function hello.main parameters must be main() or
> main(char[][] args)
> 
> Is the guy writing the example wrong? Or is it my environment? (gdc
> 0.23, on Mac OSX 10.4)

This is example of D 2, code. Who the hell published this on Wikipedia?

use:
int main(char[][] args) {
...
}

or put "alias char[] string;" before main


-- 
Witold Baryluk
MAIL: baryluk at smp.if.uj.edu.pl, baryluk at mpi.int.pl
JID: movax at jabber.autocom.pl


More information about the Digitalmars-d-learn mailing list