www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - string not aliased

reply chbrosso free.fr (Charles Brossollet) writes:
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)

Thanks,

-- 
Charles
Aug 15 2007
parent reply Jason House <jason.james.house gmail.com> writes:
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
Aug 15 2007
parent reply chbrosso free.fr (Charles Brossollet) writes:
Jason House <jason.james.house gmail.com> wrote:

 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

OK, thanks. Does anyone knows when gdc will have D2.0? Cheers, -- Charles
Aug 15 2007
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Charles Brossollet wrote:
 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

OK, thanks. Does anyone knows when gdc will have D2.0?
You can get "string" alias before D 2.0, though ? It came in DMD 1.016 and the GDC svn is currently up to DMD 1.020... David Friedman hasn't published any E.T.A. on GDC 2.0 yet. Could be since we haven't reached GDC 1.0 yet, but anyway. :) --anders PS. http://sourceforge.net/svn/?group_id=154306
Aug 15 2007
parent reply chbrosso free.fr (Charles Brossollet) writes:
Anders F Björklund <afb algonet.se> wrote:

 You can get "string" alias before D 2.0, though ? It came
 in DMD 1.016 and the GDC svn is currently up to DMD 1.020...
 
 David Friedman hasn't published any E.T.A. on GDC 2.0 yet.
 Could be since we haven't reached GDC 1.0 yet, but anyway. :)
 
 --anders
 
 PS. http://sourceforge.net/svn/?group_id=154306
Thanks, got svn gdc and it works. Just one thing: gdc --version still says it is synced to DMC 1.007, which is a bit confusing... -- Charles
Aug 15 2007
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Charles Brossollet wrote:

 Thanks, got svn gdc and it works. Just one thing: gdc --version still
 says it is synced to DMC 1.007, which is a bit confusing...
Indeed (that was true for GDC 0.23) It probably just hasn't been updated yet, but should be before release (was wrong in a previous GDC version*) You can enter a bug for it in Bugzilla perhaps, unless it's updated soon Usually one can go off the ChangeLog, where it says "Merge DMD X.YYY"... --anders * At least I think this line in my build script was for a reason: perl -pe 's using dmd 0.149 using dmd 0.157 ' -i d/gdc-version; \
Aug 15 2007