Ignoring return values in C

前端 未结 10 1450
轻奢々
轻奢々 2020-12-08 13:39

Lately, I started using lint for static code analysis. One of the warning I get sometimes is regarding this issue. Let\'s say for instance that I\'ve got the following funct

10条回答
  •  我在风中等你
    2020-12-08 14:03

    It is entirely legal and acceptable to write code that ignores the return value in some cases. The program below has very little reason to check the return value of printf().

    int main(void) {
      printf("Hello world\n");
      return 0;
    }
    

提交回复
热议问题