nasa / CF

The Core Flight System (cFS) CFDP application.
Apache License 2.0
77 stars 45 forks source link

Double semicolon in #define macro? #351

Closed thnkslprpt closed 1 year ago

thnkslprpt commented 1 year ago

Checklist

Code snips Does this macro expand out and result in a double-semicolon (i.e. an empty statement)? https://github.com/nasa/CF/blob/e1daebed33b02929945caa44404e491ef7a56d02/unit-test/utilities/cf_test_utils.h#L222

For example, here: https://github.com/nasa/CF/blob/e1daebed33b02929945caa44404e491ef7a56d02/unit-test/cf_chunk_tests.c#L355-L358

Reporter Info Avi Weiss @thnkslprpt

chillfig commented 1 year ago

Nice catch. In C, an extra semicolon like this is not a syntax error. It's essentially a null statement, so the compiler will likely optimize it away, and it should not affect the behavior of the program. Still, it's generally not a desired style, and we may want to avoid defining it this way to make the code cleaner... Adding fix