Colin King: C void return gotcha

Last week I was bitten by a interesting C feature. The following terminate function was expected to exit if okay was zero (false) however it exited when zero was passed to it. The reason is the missing semicolon after the return function.

 

The interesting part this that is compiles fine because the void function terminate is allowed to return the void return value, in this case the void return from exit().

 



from Planet Ubuntu https://ift.tt/Fr3jSfd
Colin King: C void return gotcha Colin King: C void return gotcha Reviewed by Hackers Spot on 06:42 Rating: 5

No comments:

Powered by Blogger.