Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 03, 2005 Nested main function should be treated like a common function | ||||
---|---|---|---|---|
| ||||
Nested main function should be treated like a common function. If void f(){int main(){return 0;}} is acceptable, why isn't void f(){int main(int){return 0;}} ? PS. DMD 0.112 displays the following error message: function test.f.main parameters must be main() or main(char[][] args) |
February 03, 2005 Re: Nested main function should be treated like a common function | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | zwang wrote: > Nested main function should be treated like a common function. > If void f(){int main(){return 0;}} is acceptable, why isn't > void f(){int main(int){return 0;}} ? Sounds like a bug in dmd/func.c, int FuncDeclaration::isMain : > int FuncDeclaration::isMain() > { > return ident && strcmp(ident->toChars(), "main") == 0 && > linkage != LINKc && !isMember(); > } Should probably include a check with !isNested() as well... ? --anders PS. I find this to be more amusing: cdouble main() { return 0 + 0i; } |
February 03, 2005 Re: Nested main function should be treated like a common function | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 zwang schrieb am Thu, 03 Feb 2005 22:37:02 +0800: > Nested main function should be treated like a common function. > If void f(){int main(){return 0;}} is acceptable, why isn't > void f(){int main(int){return 0;}} ? > > PS. DMD 0.112 displays the following error message: > function test.f.main parameters must be main() or main(char[][] args) Added to DStress as http://dstress.kuehne.cn/run/nested_function_05.d http://dstress.kuehne.cn/run/nested_function_06.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCAj+/3w+/yD4P9tIRAoOsAJ0aPaNv76ROMRpm6dXReqTMXxF4eQCdGJH2 5BxcNBieCCUDxyWBss5LqTI= =Ak6A -----END PGP SIGNATURE----- |
February 03, 2005 Re: Nested main function should be treated like a common function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | So fast :)
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> zwang schrieb am Thu, 03 Feb 2005 22:37:02 +0800:
>
>>Nested main function should be treated like a common function.
>>If void f(){int main(){return 0;}} is acceptable, why isn't
>>void f(){int main(int){return 0;}} ?
>>
>>PS. DMD 0.112 displays the following error message:
>>function test.f.main parameters must be main() or main(char[][] args)
>
>
> Added to DStress as
> http://dstress.kuehne.cn/run/nested_function_05.d
> http://dstress.kuehne.cn/run/nested_function_06.d
>
> Thomas
>
>
> -----BEGIN PGP SIGNATURE-----
>
> iD8DBQFCAj+/3w+/yD4P9tIRAoOsAJ0aPaNv76ROMRpm6dXReqTMXxF4eQCdGJH2
> 5BxcNBieCCUDxyWBss5LqTI=
> =Ak6A
> -----END PGP SIGNATURE-----
|
Copyright © 1999-2021 by the D Language Foundation