Jump to page: 1 2
Thread overview
string not aliased
Aug 15, 2007
Charles Brossollet
Aug 15, 2007
Regan Heath
Aug 15, 2007
Regan Heath
Aug 15, 2007
Charles Brossollet
Aug 15, 2007
Regan Heath
Aug 15, 2007
Witold Baryluk
Aug 15, 2007
Carlos Santander
Aug 15, 2007
Jason House
Aug 15, 2007
Charles Brossollet
Aug 16, 2007
Charles Brossollet
August 15, 2007
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
August 15, 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
August 15, 2007
Charles Brossollet wrote:

> 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 example is using D 2.0, while GDC supports D 1.0 at the moment.
(the language was split into two different versions a while ago...)

int main(char[][] args)

--anders
August 15, 2007
Dnia Wed, 15 Aug 2007 18:24:19 +0200
chbrosso@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@smp.if.uj.edu.pl, baryluk@mpi.int.pl
JID: movax@jabber.autocom.pl
August 15, 2007
Regan Heath wrote:

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

GDC 0.23 is based on DMD 1.007, see http://gdcmac.sf.net

--anders
August 15, 2007
Anders F Björklund wrote:
> Charles Brossollet wrote:
> 
>> 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 example is using D 2.0, while GDC supports D 1.0 at the moment.
> (the language was split into two different versions a while ago...)
> 
> int main(char[][] args)

Technically I guess it's D 1.016 or D 2.0 code.  Am I correct about rebuilding phobos (in my reply to the OP) or will that fail utterly?

Regan
August 15, 2007
Anders F Björklund wrote:
> Regan Heath wrote:
> 
>> 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.
> 
> GDC 0.23 is based on DMD 1.007, see http://gdcmac.sf.net

Ahh, thanks.

I was looking here:
http://dgcc.sourceforge.net/#doc

I saw the link to gdcmac and gdcwin but I didn't follow them.

Regan
August 15, 2007
Regan Heath <regan@netmail.co.nz> wrote:

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

GDC 0.23 is based on DMD 1.007, so that explains my problem.

Thank you very much,

-- 
Charles
August 15, 2007
Regan Heath wrote:

>> The example is using D 2.0, while GDC supports D 1.0 at the moment.
>> (the language was split into two different versions a while ago...)
>>
>> int main(char[][] args)
> 
> Technically I guess it's D 1.016 or D 2.0 code.  Am I correct about rebuilding phobos (in my reply to the OP) or will that fail utterly?

You are right, it'll probably be fixed in GDC 0.24 then. (DMD 1.018)

The aliases can probably be added to the object.d manually meanwhile
alias char[] string;
alias wchar[] wstring;
alias dchar[] dstring;

--anders
August 15, 2007
Charles Brossollet escribió:
> 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,
> 

string was added in DMD 1.016, which corresponds to GDC SVN revision 134. GDC 0.23 is only up to DMD 1.007, so get the latest GDC. You can find instructions in http://dsource.org/projects/tango/wiki/UnixInstallGdc, down to the "GDC Installation from source" section.

-- 
Carlos Santander Bernal
« First   ‹ Prev
1 2