GCC 5.1 released
gcc.gnu.org
gcc.gnu.org
"These builtins have two integral arguments (which don't need to have the same type), the arguments are extended to infinite precision signed type, +, - or * is performed on those, and the result is stored in an integer variable pointed to by the last argument. If the stored value is equal to the infinite precision result, the built-in functions return false, otherwise true. The type of the integer variable that will hold the result can be different from the types of the first two arguments."
Handling all possible integer overflow with plain C is annoyingly tricky and for some critical paths in-efficient. These built-ins can often do a conditional jump based on the overflow bit in the flags register.
Edit: here is the request for gcc to copy clang: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59708 (nice discussion about the need to have builtins for overflow detection)
And here is a request for clang to copy gcc's generic versions: https://llvm.org/bugs/show_bug.cgi?id=21716
+#if (defined(__clang__) && ((__clang_major__ > 3) \
+ || (__clang_major__ == 3 && __clang_minor__ >= 4))) \
+ || (defined(__GNUC__) && __GNUC__ >= 5)While I am glad to see gcc making progress, I feel bound to clang until gcc's warning/error reporting can get up-to-speed.
EDIT: interesting indeed. Thanks for the pointer!
(Add warning levels) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53313
Personally I don't care about that as much as the optimization improvements this time arond, it seems. Better devirtualization? AutoFDO? Reuse of the PIC hard register, especially? (That will be a great win on 32 bit machines, and makes it all the more possible to enable things like PIE for 32-bit applications, where it would otherwise be a big penalty, as well as many other things.)
I would love to have a -Weverything; as a fairly rusty C++ dev I originally thought -Wall was supposed to have, you know, all but was pretty surprised to learn it didn't actually contain all. It would be great if they deprecated -Wall and made it so -Weverything always did all warnings (including any newly introduced warnings).
Plus, writing code (in C, I cannot speak for Cxx) which results in no warning output from `-Weverything` is actually not that difficult to do, and generally the result is that you've written more robust code in the process. A lot of projects are now trying to move to compile with `-Weverything` and not disable any warnings, and I personally think it's a great move.
Of course it is possible to specifically disable useless warnings, but in my experience it's just as easy to add a reasonable selection of flags (say, -Wall -Wextra -Wold-style-cast -Wconversion -Wsign-conversion) than to start with -Weverything and work backwards. Still, it has been some time since I've tried using it; maybe I ought to give it another chance.
The result is that I still get the warnings for wherever I did not intentionally invoke these actions and still get all the other warnings that I should pay attention to for best practices.
Though I would personally argue for most people (particularly new C coders) using `-Weverything` wherever possible, if you see fit not to, that's your choice :)
http://programmers.stackexchange.com/a/124574
clang does not document its warning flags like gcc does, but a long (but now incomplete) list is available here:
In practice, if your initialization isn't sufficiently transparent, you're just busy making bugs.
The gcc manpage would be an appropriate place for developers to document any preferred replacement for -Wall, for new projects. Anyone learning build tools is likely to hit the manpages, and anyone who learns-by-google is still likely to see it in HTML ports of the manpages.
Debian is _horrible_. And it will never be good without radical changes, possibly including changing options and syntax of commands, breaking API's and ABI's and breaking every running instance of it.
Just look at basic commands. It's 'cp ifile ofile' but 'dd if=ifile of=ofile'. This one-of-many wart has to go, exiled together with all its siblings.
Common shell languages like sh and it's children are nightmarish abominations, unintuitive and unsafe - they deserve to die in flames.
We need change. A change for the better; for intuitiveness, for elegance, conformity, consistency, for learnability. Until then, Windows and Apples OS will stand a chance.
Intelligent design is what we need, not only evolution.
Not particularly useful though.
https://gcc.gnu.org/ml/gcc/2015-04/msg00287.html
And the same one for gmane lovers (like me):
And this time they managed to do it without a SONAME bump, which is nice.
I think just threads.h are missing now.
Edit: Misread the parent posts and thought they were referring to C++11. Today I learned C11 is a separate standard.
Seriously? GPL stuff can be used with any internal stuff, and almost any Free stuff. Isn't that enough? Where is the loss exactly?
Edit: okay, that wasn't the author's intention, and the consistency argument is a good one (least astonishment and all that). Still, the general argument holds.
It doesn't support LTO as yet due to the way it works so some of the juicier optimisations aren't visible. But you still get a chance to play about with the quality of the code generator.
I mean, the goal of an optimizer is literally not to be able to be tricked into doing work it doesn't have to.
If the language is such that there are things in the language that inherently require tricking the optimizer, the language is doing it wrong.
Volatile has... problems. It was meant more for mem-mapped IO than thread safety.
And it's too powerful at the same time, as in there are a number of optimizations that are safe in the typical use cases of volatile that cannot be done to volatile variables.