string not aliased

Regan Heath regan at netmail.co.nz
Wed Aug 15 09:28:49 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 string alias was added in DMD 1.016:
http://www.digitalmars.com/d/1.0/changelog.html#new1_016

GDC 0.21 was based on DMD 1.000, but I have no idea what GDC 0.23 is 
based on as I cannot see that info on the GDC page.

I suspect it's still based on DMD 1.000 and therefore has no aliases.

However, the aliases are defined in phobos and I suspect if you grab the 
latest phobos source and build it you will solve your problem.

Regan


More information about the Digitalmars-d-learn mailing list