string not aliased

Jason House jason.james.house at gmail.com
Wed Aug 15 10:47:17 PDT 2007


Charles Brossollet Wrote:

> 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)


The current gdc supports d version 1.x.  The example you're doing, I believe, is for an alpha version of d (version 2.x).  const(char) and various const/final/invariant stuff was added in 2.x (and is the reason for the version # increase and calling it an alpha release)


More information about the D.gnu mailing list