digitalmars.D.bugs - return in void functions
- Thomas Kuehne (25/26) Dec 08 2004 -----BEGIN PGP SIGNED MESSAGE-----
- Simon Buchan (20/47) Dec 09 2004 Suppose that depends on whether you think the doc or the code is in erro...
- Lionello Lunesu (19/28) Dec 09 2004 [...]
- tetsuya (8/23) Dec 14 2004 To Walter,
- Thomas Kuehne (14/41) Dec 09 2004 -----BEGIN PGP SIGNED MESSAGE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 http://digitalmars.com/d/statement.html#return return_01.d:cannot implicitly convert expression dummy() of type int to voidtest case: http://svn.kuehne.cn/dstress/run/return_01.d Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.13 (GNU/Linux) iD8DBQFBuAKf3w+/yD4P9tIRAkgkAKCHGuKCjlfCHCqr/BsrzWCwZtp06QCgwzXj HpgFpl2Jv4TkX2FFl4EQA5w= =TvmZ -----END PGP SIGNATURE-----
Dec 08 2004
On Thu, 9 Dec 2004 08:45:37 +0100, Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 http://digitalmars.com/d/statement.html#return type. return_01.d:Suppose that depends on whether you think the doc or the code is in error there. (Why would you need to evaluate an expression (pun-roll, please) expressly in a return statement?) -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" -- "I plan on at least one critical patch every month, and I haven't been disappointed." - Adam Hansen, manager of security at Sonnenschein Nath & Rosenthal LLP (Quote from http://www.eweek.com/article2/0,1759,1736104,00.asp) -- "It's been a challenge to "reteach or retrain" Web users to pay for content, said Pizey" -Wired website: "The Incredible Shrinking Comic"cannot implicitly convert expression dummy() of type int to voidtest case: http://svn.kuehne.cn/dstress/run/return_01.d Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.13 (GNU/Linux) iD8DBQFBuAKf3w+/yD4P9tIRAkgkAKCHGuKCjlfCHCqr/BsrzWCwZtp06QCgwzXj HpgFpl2Jv4TkX2FFl4EQA5w= =TvmZ -----END PGP SIGNATURE-----
Dec 09 2004
Hi..[...]http://digitalmars.com/d/statement.html#return type.[...]cannot implicitly convert expression dummy() of type int to voidSuppose that depends on whether you think the doc or the code is in error there.I agree. I think the type should still match, so you can do "return some_func_that_returns_void();" in a function returning void, which feels like it should be allowed since that return wants void and the called function returns void.(Why would you need to evaluate an expression (pun-roll, please) expressly in a return statement?)To eliminate an extra pair of braces: if (sometest) return do_something(); instead of: if (sometest) { do_something(); return; } (I for one like D's behaviour.) -- L. -- Get the root certificate at https://www.cacert.org/
Dec 09 2004
In article <cp9nto$d4p$1 digitaldaemon.com>, Lionello Lunesu says...Hi..To Walter, In case the doc is gonna be adopted, is 'out (result)' going to be allowed after such void functions? [...]http://digitalmars.com/d/statement.html#return type.Maybe it's also useful for contract, huh? Returning type would be a concern, though. -tetsuya(Why would you need to evaluate an expression (pun-roll, please) expressly in a return statement?)To eliminate an extra pair of braces: if (sometest) return do_something(); instead of: if (sometest) { do_something(); return; }
Dec 14 2004
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Simon Buchan schrieb am Fri, 10 Dec 2004 03:18:07 +1300:On Thu, 9 Dec 2004 08:45:37 +0100, Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> wrote:http://digitalmars.com/d/statement.html#return type. return_01.d:cannot implicitly convert expression dummy() of type int to voidtest case: http://svn.kuehne.cn/dstress/run/return_01.dSuppose that depends on whether you think the doc or the code is in error there. (Why would you need to evaluate an expression (pun-roll, please) expressly in a return statement?)I usually would say that the the doc has the highest priority ... But this rule seems very odd. Unless someone provides me with a valid reason to keep this, I would suggest to adapt the documentation to the current implementation. Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.13 (GNU/Linux) iD8DBQFBuGPH3w+/yD4P9tIRAuiKAKCT5mHK8n2q3G1A+6Zn6g8upoePpwCg0ULf Q20vF3Cb0WlT6pQmIxk7lyA= =8m4O -----END PGP SIGNATURE-----
Dec 09 2004