[swift-evolution] Make non-void functions @warn_unused_result by default

Dmitri Gribenko gribozavr at gmail.com
Wed Mar 2 12:46:50 CST 2016


On Wed, Mar 2, 2016 at 9:36 AM, Gwendal Roué <swift-evolution at swift.org> wrote:
> As soon as there is a warning ignoring the returned value, as would be the default if the discussed proposal were accepted, people will start writing `_ = …` just to *silence* the warning.

Only if the API is badly designed and not annotated properly.  You
can't protect users from bad API design.  Saying that the feature is
harmful because it can be misused in bad APIs is counter-productive,
because this is true for almost every feature.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-evolution mailing list