static analysis - In C macros, should one prefer do { ... } while(0,0) over do { ... } while(0)? -


A customer recently analyzed the statistical analysis of his employer's C codebase and gave us results. Between the useful patch, the famous macro was requested to change the do {...} (0,0) . I understand what their patches are doing (evaluate the value of the second "0" to evaluate the sequence operator return , the effect is the same), but it is not clear if they Why will it be in favor of the party

Is there any valid reason that the second form of macro should be preferred, or does our client's static analysis be highly endangered?

Well, I will go for an answer:

Is there a legitimate reason that any other form should prefer the macro ...?

There is no valid reason why both of them always evaluate false, and any decent compiler will probably change the second one in the assembly for the first time. If in some cases there was a reason for it being invalid, then C. has been there for a long time to discover more than me from the gurus.

If you like to see your code in Owl-Y eyes, when using (0,0) otherwise, use the rest of the C programming world Ask your client's static analysis tool to push it.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -