LWN: Comments on "Wielaard: Looking forward to GCC6 – Many new warnings" https://lwn.net/Articles/675699/ This is a special feed containing comments posted to the individual LWN article titled "Wielaard: Looking forward to GCC6 – Many new warnings". en-us Tue, 21 Oct 2025 08:39:12 +0000 Tue, 21 Oct 2025 08:39:12 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/678680/ https://lwn.net/Articles/678680/ bronson <div class="FormattedComment"> Hyper-optimized codecs and graphics code... but that's still very specialized. Anyone who isn't sure if -Werror is necessary should ship with it off.<br> </div> Thu, 03 Mar 2016 23:00:51 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/678664/ https://lwn.net/Articles/678664/ nix <div class="FormattedComment"> There is one special case where this doesn't apply: where the software is arch-dependent enough and delicate enough that it should only be compiled with specific compilers (or with compilers in a specific version range) and on supported arches. This is particularly true where the software is crucial and any new warnings are quite likely a sign of impending disaster. On such systems, -Werror is actually really useful.<br> <p> glibc is the only such software I can think of right now, on Linux at least.<br> <p> </div> Thu, 03 Mar 2016 21:20:21 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/677232/ https://lwn.net/Articles/677232/ jwakely <div class="FormattedComment"> That used to be true, but isn't now, see <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#903">http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.h...</a><br> <p> <font class="QuotedText">&gt; A null pointer constant is an integer literal (2.13.2 [lex.icon]) with value zero or a prvalue of type std::nullptr_t.</font><br> <p> So false and (0+0) and (1-1) are no longer null pointer constants and cannot be implicitly converted to pointer types.<br> <p> If you want a pointer then use a pointer, not a bool or some other type.<br> </div> Thu, 25 Feb 2016 09:44:59 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/677215/ https://lwn.net/Articles/677215/ HelloWorld <div class="FormattedComment"> Yeah, so? Using nulptr here rather than false would lead to the exact same runtime behaviour, so how is this a genuine problem?<br> </div> Thu, 25 Feb 2016 06:59:15 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676714/ https://lwn.net/Articles/676714/ epa <div class="FormattedComment"> Oh I agree, I certainly see the value in making sure there are zero warnings during development - I just don't see why the source tarball given to distributions and end users needs to have fatal warnings set. There may well be warnings which pop up on some other architecture, but they are probably just warnings rather than hard errors, and it is the user's or packager's choice whether to treat them as serious enough to abandon the build.<br> </div> Mon, 22 Feb 2016 10:07:18 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676639/ https://lwn.net/Articles/676639/ ms_43 <div class="FormattedComment"> <font class="QuotedText">&gt; aiui, LibreOffice actually has config options in the build system for "each" distro.</font><br> <p> Where "distro" means "Linux", "MacOSX", "Win32" or "Android".<br> <p> <a href="https://cgit.freedesktop.org/libreoffice/core/tree/distro-configs">https://cgit.freedesktop.org/libreoffice/core/tree/distro...</a><br> </div> Sun, 21 Feb 2016 13:48:36 +0000 Ceterum Censeo https://lwn.net/Articles/676637/ https://lwn.net/Articles/676637/ ms_43 <div class="FormattedComment"> <font class="QuotedText">&gt; new[] initializes values to the default constructor of the array subscript type</font><br> <p> yes (if an explicit initialization expression is omitted).<br> <p> <a href="https://github.com/cplusplus/draft/blob/master/source/expressions.tex#L3215">https://github.com/cplusplus/draft/blob/master/source/exp...</a><br> <p> <font class="QuotedText">&gt; (zeroes for integral and floating-point types;</font><br> <p> no, that would be zero-initialization!<br> <p> operator new performs default-initialization, which calls an applicable no-argument constructor for class types, otherwise does nothing.<br> <p> <a href="https://github.com/cplusplus/draft/blob/01c0772e922e5edcd67414bc6831fd31f5c4b348/source/declarators.tex#L2513">https://github.com/cplusplus/draft/blob/01c0772e922e5edcd...</a><br> <p> </div> Sun, 21 Feb 2016 13:34:14 +0000 Ceterum Censeo https://lwn.net/Articles/676513/ https://lwn.net/Articles/676513/ bronson <div class="FormattedComment"> It was way better than the guesses itvirta posted though! And nice and succinct.<br> </div> Fri, 19 Feb 2016 19:12:41 +0000 Ceterum Censeo https://lwn.net/Articles/676443/ https://lwn.net/Articles/676443/ cortana <p>Your version of the story misses out several details that were covered in <a href="https://lwn.net/Articles/282038/">Debian, OpenSSL, and a lack of cooperation</a> posted to a certain web site some time ago. Fri, 19 Feb 2016 14:13:08 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676330/ https://lwn.net/Articles/676330/ dirtyepic <div class="FormattedComment"> In half the cases it's not a new option throwing a warning at you, it's an old option that learned some new tricks (or likely, some new false positives).<br> </div> Fri, 19 Feb 2016 00:18:52 +0000 Ceterum Censeo https://lwn.net/Articles/676312/ https://lwn.net/Articles/676312/ Sesse <div class="FormattedComment"> That's a false dichotomy. What's much more likely is that someone used a different compiler which has a different set of warnings. Not all the world is GCC.<br> <p> Most warnings, especially in code that's been around for a while, are _not_ signs of actual bugs. (It's good style to fix them nevertheless, because some are, but that should not block the compile for an end user.)<br> <p> /* Steinar */<br> </div> Thu, 18 Feb 2016 21:54:04 +0000 Ceterum Censeo https://lwn.net/Articles/676308/ https://lwn.net/Articles/676308/ mpr22 <p>My C and C++ code builds without warnings on my system, because I do all my development with -Werror enabled. Thus, if my C and C++ code produces warnings when compiled on <em>someone else</em>'s system, then either their toolchain is (defective|deficient|misconfigured) or there is an issue with my code which needs to be properly examined by a human, and that someone else should probably not be distributing binaries to other people until it has been.</p> Thu, 18 Feb 2016 21:48:06 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676279/ https://lwn.net/Articles/676279/ mjw <div class="FormattedComment"> But that is the whole point isn't it? If your setup is so different from the supported setups of the project as released that you get new warnings then you do need to carefully check them and ideally discuss with the project maintainers how to resolve them. In my experience that is exactly what happens. Distros that have architecture support not yet seen by the project contribute fixes back and we work together to make sure newer compiler warnings are fixed (which often means there was some subtle bug in the code in the first place). It grows the project to include these new environments as supported. And it makes sure no subtle bugs slip in because people ignore warnings. IMHO it is exactly as making sure your testsuite is zero fail and if not to abort the build so nothing is ever released that is known broken.<br> </div> Thu, 18 Feb 2016 17:58:23 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676222/ https://lwn.net/Articles/676222/ pizza <div class="FormattedComment"> <font class="QuotedText">&gt; I am somewhat surprised by the hostility against -Werror. </font><br> <p> It's awesome for the tail end of development work leading up to a release, but IMO it has no place in a release package if that package is intended to be compiled by random third parties. The same code on different versions of the compiler (or even the same compiler on different platforms) will result in different sets of warnings.<br> </div> Thu, 18 Feb 2016 13:44:26 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676201/ https://lwn.net/Articles/676201/ mjw <div class="FormattedComment"> I am somewhat surprised by the hostility against -Werror. Personally I use it religiously in my projects and take pride in having the build explicitly break if a warning slips through. I do select the set of warnings (normally at least -Wall and -Wextra and then some of the non-default ones after making sure they catch some real bugs, and then fix any false positive, like some of those in this blog post did). My experience with distros is actually pretty positive. Package maintainers do warn (pun intended!) us when the build breaks because a new warning is detected on some setup we didn't test yet ourselves and we work together to get the build clean again. In fact one real bug was found when Debian tried a mass rebuild with gcc6 because of -Wmisleading-indentation. It was an obscure bug that would probably not trigger in normal situations, but it was nice to find it because it would have been a pain to diagnose otherwise. You do have to have a good relationship with the package maintainers of your project to make -Werror work, but then it really is IMHO a pretty sweet deal.<br> </div> Thu, 18 Feb 2016 10:02:24 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676199/ https://lwn.net/Articles/676199/ mjw <div class="FormattedComment"> I agree that -Weverything is pretty silly. Not all warnings are equal. Some are like -Wtemplate or -Weffc++ are really about coding style (and don't normally signal a possible bug). And then there are warnings like -Wwrite-strings that change the type of some constructs effectively changing the code. Most people are probably not interested in such warnings in the first place.<br> <p> But for other categories of warnings (where there is the potential that it does indeed signal a subtle bug that might need some analysis even if it could be a false positive) it would be really nice to have some way to enable them all and just see what warning results you get. Is it really too hard to define two or three categories of warnings that can easily be enabled all at once?<br> <p> I certainly appreciate the GCC documentation. It is pretty good. And it was fun to compare the info pages of the current and new version of GCC to get an overview of all the new warning options to try out. I learned a lot! But an easier way to discover new warnings (especially those not enabled by default or through -Wall or -Wextra) would be appreciated.<br> </div> Thu, 18 Feb 2016 09:49:23 +0000 Ceterum Censeo https://lwn.net/Articles/676163/ https://lwn.net/Articles/676163/ tialaramex <div class="FormattedComment"> Version of the story which is popular and you're repeating to us:<br> <p> * OpenSSL is so crappy it relies on uninitialised memory reads to do random number generation even though, er, that can't work on Unix<br> * Hero Debian Guy fixes the uninitialised reads<br> * Somehow this breaks OpenSSL because it needed uninitialised reads, even though er, they didn't work so... um.<br> <p> Actual reality of the story<br> <p> * OpenSSL is so crappy it has several similar-looking C functions that actually do different stuff<br> * Debian Guy spots that function A does a harmless uninitialised read and fixes it, arguably making the code more "correct" but with no functional change.<br> * Idiot Debian Guy sees a similar function B and blindly applies the same "fix".<br> * The "fix" to this function B disables its entire purpose, effectively removing the PRNG feature almost entirely<br> <p> I don't know if either story has anything to tell us about GCC6. But I do know that spreading the former story is harmful.<br> </div> Wed, 17 Feb 2016 23:58:06 +0000 Ceterum Censeo https://lwn.net/Articles/676129/ https://lwn.net/Articles/676129/ itvirta <div class="FormattedComment"> Well, of course commenting out lines without understanding what they do is either silly or plain stupid.<br> <p> But in that particular case, the ultimate reason seems to be that someone tried to be smarter than they should have<br> been, and did something that is both wrong (in the language sense) and not very useful either.<br> <p> Wrong, since as far as I can find, the point was to read uninitialized memory, and that results in undefined behaviour<br> with the full demons-flying-from-ones-mouth possibility included.<br> <p> Not very useful since the whole thing was to "safeguard" against not having a good RNG by creating a really shitty RNG.<br> Same goes for the fact that the library used the PID to seed the RNG. PIDs aren't really secret or random and make for<br> a rather shitty RNG. Had the library not used such a weak addition, the final screw-up might have been detected sooner,<br> since all the outputs would have been exactly the same, instead of having the 2^15 different possibilities (or whatever<br> the number was).<br> <p> All of this goes with a big IIRC disclaimer, so feel free to point me wrong.<br> However, I do find the custom of solely blaming a silly mistake while ignoring the fucked-up design really tiring.<br> <p> <p> </div> Wed, 17 Feb 2016 21:20:29 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/676133/ https://lwn.net/Articles/676133/ Sesse <div class="FormattedComment"> Sure, when all upstream app developers commit to making their own packages for the 10–15 architectures people care about on Linux, and keep them up-to-date wrt. security and such.<br> <p> /* Steinar */<br> </div> Wed, 17 Feb 2016 21:09:31 +0000 Re: In C++, you need type information as part of the ABI. https://lwn.net/Articles/676128/ https://lwn.net/Articles/676128/ ldo <P>The ABI can only handle a small subset of the necessary type information. <P>Consider the Ada declaration <BLOCKQUOTE> <TT>type </TT><I>B</I><TT> is new </TT><I>A</I><TT>;</TT> </BLOCKQUOTE> which means that type <I>B</I> is essentially a copy of type <I>A</I>, inheriting all the functionality defined for it. But <I>B</I> must still be considered distinct from <I>A</I>, and incompatible with it. <P>Then you have subtypes, which are considered compatible with the type they derive from, but are subject to additional constraints. <P>There can be no code or runtime data associated with these definitions, which is why you cannot represent them in any ABI. Yet they need to be processed across compilation units. Isn’t that a natural job for the linker? Wed, 17 Feb 2016 21:00:19 +0000 Ceterum Censeo https://lwn.net/Articles/676127/ https://lwn.net/Articles/676127/ ksandstr <div class="FormattedComment"> Whether it's using new[] or malloc is, in fact, very important here: new[] initializes values to the default constructor of the array subscript type (zeroes for integral and floating-point types; the same rule is applied to all members of structs to make up an implicit default constructor), while malloc() does no initialization at all.<br> <p> So if you're seeing consistent results, you're either using new[] or malloc() in a process that hasn't freed much of the memory it's allocated and written yet. But sure enough, valgrind does complain about uninitialized values when reading from new[]'d arrays -- this should be reported and corrected.<br> <p> Back in 2006 it was still realistic that valgrind wouldn't become yet another mindlessly-followed lint. It had innovations like data tracking instrumentation and what-not. Alas.<br> </div> Wed, 17 Feb 2016 20:52:58 +0000 Ceterum Censeo https://lwn.net/Articles/676114/ https://lwn.net/Articles/676114/ juliank <div class="FormattedComment"> Thing is, we don't really mmap() for writing anymore (only for reading), but use new[] instead (or malloc, idk right now). We then do a nearly-atomic write to temporary cache &amp; rename transaction.<br> <p> Valgrind currently complains about that, but oh well, it's at least clearly identifiable. Should still get fixed at some point.<br> </div> Wed, 17 Feb 2016 19:43:18 +0000 Many new warnings, but still not my pet peeve https://lwn.net/Articles/676112/ https://lwn.net/Articles/676112/ ksandstr <div class="FormattedComment"> Somewhat relatedly, this issue recently won the 2015 Underhanded C Competition.<br> </div> Wed, 17 Feb 2016 19:31:17 +0000 Ceterum Censeo https://lwn.net/Articles/676109/ https://lwn.net/Articles/676109/ ksandstr <div class="FormattedComment"> However, POSIX initializes fresh mmap() memory to all zeroes, but uninitialized automatic arrays in a function are truly uninitialized in that they contain arbitrary detritus from the thread stack (whatever that was un-/initialized to). In essence, APT performs a well-defined function that yields consistent results despite "you" thinking it doesn't.<br> </div> Wed, 17 Feb 2016 19:20:32 +0000 Ceterum Censeo https://lwn.net/Articles/675994/ https://lwn.net/Articles/675994/ bronson <div class="FormattedComment"> The direct reason the SSL bug entered Debian was to get rid of the warning.<br> <p> Or, if you're saying that it's normal to go commenting out lines of code to eradicate warnings -- because it's ultimately the fault of the person who wrote the questionable code -- then I guess this is a fine example of the problem. Thank you!<br> <p> Remember, warning-driven development only works when you're using a perfect compiler.<br> </div> Wed, 17 Feb 2016 16:05:06 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675988/ https://lwn.net/Articles/675988/ andresfreund <div class="FormattedComment"> Indeed. Similar false positives are common with -Wtype-limits as well. E.g. a somechar &gt;= 0, where common platforms will spew warnings about the check being redundant, but for a signed char the check might be important. Dealing with warnings like these can be quite frustrating :(<br> </div> Wed, 17 Feb 2016 15:45:32 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675967/ https://lwn.net/Articles/675967/ itvirta <div class="FormattedComment"> Of course that particular check should probably be written as (value &gt; min(limit1, limit2))<br> since that's what logically happens (and the optimiser will happily remove the non-dominating bound anyway).<br> <p> Apparently a warning is not given if the limits are different, even though that might<br> catch the case where check was supposed to be (value &gt; limit1 || value2 &gt; limit2) but the other<br> variable name was mistyped.<br> <p> <p> </div> Wed, 17 Feb 2016 14:13:48 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675958/ https://lwn.net/Articles/675958/ mathstuf <div class="FormattedComment"> C++11 introduced nullptr which allows pointer logic with NULL to be much stricter. Relevant links:<br> <p> <a href="https://stackoverflow.com/questions/32009694/why-implicit-conversion-of-bool-to-string-isnt-an-error/32009989?noredirect=1#comment51927225_32009989">https://stackoverflow.com/questions/32009694/why-implicit...</a><br> <a href="https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg464585.html">https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg4645...</a><br> </div> Wed, 17 Feb 2016 12:09:44 +0000 Ceterum Censeo https://lwn.net/Articles/675957/ https://lwn.net/Articles/675957/ juliank <div class="FormattedComment"> Fun fact: We use uninitialized memory in APT. That is, for the binary (mmap()able) cache, we allocate memory and initialise parts of that.<br> <p> We store all of it though, and calculate a checksum of it all, including the not yet initialised parts.<br> </div> Wed, 17 Feb 2016 12:05:06 +0000 Ceterum Censeo https://lwn.net/Articles/675953/ https://lwn.net/Articles/675953/ itvirta <div class="FormattedComment"> That would be the type of people who deliberately access uninitialized memory. <br> They are surely not to be trusted, but that has little to do with warnings. <br> <br> </div> Wed, 17 Feb 2016 11:29:17 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675888/ https://lwn.net/Articles/675888/ HelloWorld <div class="FormattedComment"> <font class="QuotedText">&gt; One was a compile error caused by returning "false" instead of a nullptr</font><br> Why would this be a problem? Every integral constant-expression with a value of 0 is a valid null pointer literal. It's certainly uncommon to use false for this purpose, but probably not a real problem.<br> </div> Wed, 17 Feb 2016 10:36:57 +0000 Re: the linker doesn't care much about matching symbols https://lwn.net/Articles/675930/ https://lwn.net/Articles/675930/ niner <div class="FormattedComment"> "it's the tools' job to properly unmangle names."<br> <p> That's the problem right there: the assumption, that there is "the" tool, rather than multiple tools. With multiple tools, they have to agree on how to mangle the names. If that's standardized (even if it's just de facto) like the bit of mangling that C does, interoperation is easy. That's why I can call an abritrary C library's functions from Perl 6 without even needing a C compiler on the machine[1]. Binding to C++ libraries on the other hand is really hard. It needs special code to support each compiler[2].<br> <p> [1] <a href="http://doc.perl6.org/language/nativecall">http://doc.perl6.org/language/nativecall</a><br> [2] <a href="https://github.com/rakudo/rakudo/blob/nom/lib/NativeCall/Compiler/GNU.pm6">https://github.com/rakudo/rakudo/blob/nom/lib/NativeCall/...</a><br> </div> Wed, 17 Feb 2016 08:06:38 +0000 Ceterum Censeo https://lwn.net/Articles/675890/ https://lwn.net/Articles/675890/ nix <div class="FormattedComment"> You mean the sort of person who makes compiler warnings fatal on every machine the thing is compiled on, even though many warnings vary per-architecture and almost all vary per-compiler-version?<br> <p> Yeah, I'd trust that sort of person a whole lot -- to make mistakes through ignorance.<br> </div> Wed, 17 Feb 2016 00:17:19 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675885/ https://lwn.net/Articles/675885/ rahvin <div class="FormattedComment"> It didn't lead to misbehavior that you know of. My experience with computers and software in general is if you let the computer make a decision about something (such as exactly where the brace ending the If statement actually is) the computer will assume something completely random that doesn't make any sense. Those are the kind of errors that lead to untraceable bugs because the compiler made an assumption about where the IF statement ended that and you know you would never see that missing brace while troubleshooting. <br> <p> Though I have to admit that error name isn't very descriptive.<br> </div> Tue, 16 Feb 2016 23:00:12 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675882/ https://lwn.net/Articles/675882/ Wol <div class="FormattedComment"> aiui, LibreOffice actually has config options in the build system for "each" distro.<br> <p> So you can take an upstream git pull, and run make for your distro. So the distro can tweak things, and they go upstream so the user can see what's going on - that is, if they can understand the build system ... :-)<br> <p> Cheers,<br> Wol<br> </div> Tue, 16 Feb 2016 22:28:42 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675881/ https://lwn.net/Articles/675881/ Wol <div class="FormattedComment"> <font class="QuotedText">&gt; Personally I can't see the value in fatal warnings</font><br> <p> Having had some warnings that I couldn't get rid of, it can be a real problem, but I'd rather have fatal warnings switched on if I can. That way, I know my code is as clean as possible, and having taken over code that originally had minimal warnings and lots of subtle bugs, that's the way I like it ... :-)<br> <p> Cheers,<br> Wol<br> </div> Tue, 16 Feb 2016 22:21:11 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675872/ https://lwn.net/Articles/675872/ fratti <div class="FormattedComment"> I highly recommend giving the SVN version a spin - while the &gt;1 hour it took me to build GCC, it found 3 actual problems in the first codebase I ran it on. One was a compile error caused by returning "false" instead of a nullptr, two others were caught by -Wmisleading-indentation and were cases of forgotten curly braces around if-conditions.<br> <p> As far as I can tell, none of the uncovered issues had a real world impact; while the code was different than intended it did not lead to program misbehaviour. However, it'll probably save some headaches if the surrounding code were to be refactored.<br> </div> Tue, 16 Feb 2016 21:35:09 +0000 Wielaard: Looking forward to GCC6 – Many new warnings https://lwn.net/Articles/675870/ https://lwn.net/Articles/675870/ xtifr <div class="FormattedComment"> Hmm, I can see the new meaning of -Wlogical-op causing some problems with platform-specific code. Imagine:<br> <p> #if defined(PLATFORM1)<br> #define LIMIT1 64<br> #define LIMIT2 32<br> #elif defined(PLATFORM2)<br> #define LIMIT1 32<br> #define LIMIT2 64<br> #elif defined(PLATFORM3)<br> #define LIMIT1 32<br> #define LIMIT2 32<br> #endif<br> ...<br> if (value &gt; LIMIT1 || value &gt; LIMIT2) ...<br> <p> On Platform 3, this would generate a warning about a redundant comparison (error with -Werror). Of course, there are numerous ways to work around this problem, but, still...<br> </div> Tue, 16 Feb 2016 21:07:46 +0000 Re: All Ada compilers I had worked with (around 20 years ago…) also used name mangling. https://lwn.net/Articles/675866/ https://lwn.net/Articles/675866/ ldo <A HREF="https://gcc.gnu.org/onlinedocs/gcc-4.3.4/gnat_ugn_unw/Comparison-between-GNAT-and-C_002fC_002b_002b-Compilation-Models.html#Comparison-between-GNAT-and-C_002fC_002b_002b-Compilation-Models">GNAT does not</A>. Tue, 16 Feb 2016 20:02:10 +0000 Re: the linker doesn't care much about matching symbols https://lwn.net/Articles/675856/ https://lwn.net/Articles/675856/ darktjm <div class="FormattedComment"> Yes, I mean type consistency between object modules for exported functions and data objects.<br> <p> Ada was designed for type safety in this regard, and C wasn't. Simple as that. It's one of the many features that I love(d) about Ada. You could give C the benefit of the doubt, having been designed 10 years earlier than Ada. At least it's more type-safe than its predecessors. In any case, I'm not talking about doing this in the linker, although that is possible if debugging info with type information is used for that purpose (or if a GCC-specific section type were to be added for this purpose, I guess), and it would be better/more secure than the warnings I'm proposing. The warnings I'm proposing are simply to ensure that you declare all globals in a header file. That alone does not guarantee that the same header file is used to declare the globals the same way in multiple separate modules, but it does prevent people from sloppily declaring the same function/global data object in every C file and then forgetting to change it later on when the original changes (or doing it wrong in the first place). It also prevents library conflicts due to excessive exports, since you are more aware of what you're exporting. In other words, I'm proposing a warning enforcing good coding practice (which a linker fix would not do, by the way), similar to the indentation warning mentioned in the summary.<br> <p> </div> Tue, 16 Feb 2016 19:11:29 +0000