Re:GCC 6: -Wmisleading-indentation vs. “goto fail;”
by TorKlingberg on Friday February 26, 2016 @12:45PM
(#11182751)
How would you use the ternary operator there? Like this?
[ Parent
| on HN ]
Re:GCC 6: -Wmisleading-indentation vs. “goto fail;”
by dcvuob on Friday February 26, 2016 @12:51PM
(#11182795)
Yes. And cast that 0 to (void), so the compiler won't complain over an unused expression.
Any C programmer will recognize what (void)0 means, do nothing.
Re:GCC 6: -Wmisleading-indentation vs. “goto fail;”
by TorKlingberg on Friday February 26, 2016 @01:05PM
(#11182879)
Sure, but I find it strange to use the ternary operator and discarding the value. It's not wrong, but I think most C programmers prefer a simple if statement.