Using GDC rev-50.
//---------
int main (lazy char [][] args)
{
return args.length;
}
//---------
$ gdmd test
$ ./test
Illegal instruction
$ ./test foo
Illegal instruction
//---------
How valid is this code?
Comment #1 by kirklin.mcdonald — 2006-12-06T16:45:36Z
[email protected] wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=656
>
> Summary: lazy in main
> Product: GDC
> Version: unspecified
> Platform: Macintosh
> OS/Version: Mac OS X
> Status: NEW
> Severity: normal
> Priority: P2
> Component: glue layer
> AssignedTo: [email protected]
> ReportedBy: [email protected]
>
>
> Using GDC rev-50.
>
> //---------
> int main (lazy char [][] args)
> {
> return args.length;
> }
> //---------
> $ gdmd test
> $ ./test
> Illegal instruction
> $ ./test foo
> Illegal instruction
> //---------
>
> How valid is this code?
>
>
It shouldn't be valid. At the very bottom of
http://digitalmars.com/d/function.html it says:
main() must be declared using one of the following forms:
void main() { ... }
void main(char[][] args) { ... }
int main() { ... }
int main(char[][] args) { ... }
int main(lazy char[][] args) isn't any of these. I'm not even sure what
it's supposed to mean.
Comment #2 by casantander1 — 2006-12-06T16:53:12Z
(In reply to comment #1)
> [email protected] wrote:
> > http://d.puremagic.com/issues/show_bug.cgi?id=656
> >
> > //---------
> > int main (lazy char [][] args)
> > {
> > return args.length;
> > }
> > //---------
> > $ gdmd test
> > $ ./test
> > Illegal instruction
> > $ ./test foo
> > Illegal instruction
> > //---------
> >
> > How valid is this code?
> >
> >
>
> It shouldn't be valid. At the very bottom of
> http://digitalmars.com/d/function.html it says:
>
> main() must be declared using one of the following forms:
>
> void main() { ... }
> void main(char[][] args) { ... }
> int main() { ... }
> int main(char[][] args) { ... }
>
> int main(lazy char[][] args) isn't any of these. I'm not even sure what
> it's supposed to mean.
>
Neither do I, but if it's not supposed to be valid, the compiler shouldn't compile it.