c is incompatible to c++. c++2a is going to add designated initializers, but c is a lot more lax with its type system (outputting warnings where c++ would output errors)
-
-
Replying to @dark_kirb @byuu_san and
In some cases it doesn't warn at all, e.g. void* semantics
1 reply 0 retweets 0 likes -
converting to void* is implicit in c++, converting back implicitly is an error, doing math on a void* pointer is either a warning or an error, not sure which
1 reply 0 retweets 0 likes -
Replying to @dark_kirb @byuu_san and
Doing pointer arithmetic on void* is undefined in C but gcc in its infinite wisdom treats this as a warning and a pointer to a size-1 value.
1 reply 0 retweets 0 likes -
Replying to @endrift @dark_kirb and
Don't EVER do this though. Please. It's bad.
2 replies 0 retweets 0 likes -
This is why I use -Werror -Wno-error=unused -Wno-error=unused-variable -Wno-error=reorder in many cases, simply because these mistakes can be pretty easy to make and hard to track down
1 reply 0 retweets 1 like -
Replying to @dark_kirb @byuu_san and
I wish I could trust -Werror but gcc is so volatile with what it treats as an error that it would be a compatibility nightmare
1 reply 0 retweets 1 like -
-Werror turns all warnings it would display into errors. The flags after that just remove errors from things that simply don't matter nearly as much
2 replies 0 retweets 0 likes -
Replying to @dark_kirb @endrift and
-Werror alone won't help you here because GCC doesn't warn for what it stupidly considers perfectly legitimate use of its extensions. Also you should never ship packages that use -Werror. -Werror is for development only. Otherwise a GCC update *will* break your package.pic.twitter.com/PUrnTt6lNr
1 reply 0 retweets 0 likes -
yeah, there is a reason why you have to pass --disable-werror when you build binutils from source. But if your code compiles with -Wall -Wextra and my above flags on both latest gcc and clang there aren't going to be as many UB/readability problems with your code i guess
1 reply 0 retweets 0 likes
Yeah, all this stuff is great for debug builds. I always use -Wall but I usually wind up with Makefiles set up for abbreviated output (or buildsystems that do the same) that make warnings obvious anyway, and then I fix them when I see them.
-
-
Replying to @marcan42 @dark_kirb and
I understood about 85% of this thread and it makes me feel severely inferior yet also slightly proud
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.