return from 1 point in function

> **Possible Duplicate:** > [Should a function have only one return statement?](https://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement) Hello, gcc 4.4.4 c89 Is it good programming practice to return from 1 point in a function. I have written a function below. However, I am returning from 2 possible points. Is this good style? static int init_data(struct timeout_data_t *timeout_data) { if(timeout_data == NULL) { fprintf(stderr, " [ %s ] [ %d ]\n", __func__, __LINE__); return FALSE; } /* Assign data */ timeout_data->seconds = 3; timeout_data->func_ptr = timeout_cb; return TRUE; }
Exact duplicate of the wildly popular Should a function have only one return statement?

以上就是return from 1 point in function的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏