And again, /you/ are missing the point. No one working on serious
programming /does/ run their compiler like that.
People writing code that will work on a range of platforms and compilers
may aim for such "cc program.c" compilations to work. But they don't
use that for their development - they enable warnings, they use
debugging options, they use memory leak detectors, they use linters and
checkers - whatever makes their development process simpler.
And people writing code for a rocket control system would never even
bother with how the code compiles without the right options - the
compiler and the options used are considered critical parts of the
project and are not left to the whims of a random user.
> And the other part of it is that a major compiler like MSVC didn't even
> support that feature.
MSVC is a major C++ compiler - it is not a major C compiler, and is
badly out of date for C. AFAIK, it does not even support all of C99,
never mind C11. But it has Static_assert in C++11 modes.
>
>> Why does my gcc not give me swamps of other warnings? Because I know
>> how to use my compiler, and how to write quality C code, and you don't.
>
> Yes I know. That means that when creating, modifying or extending an
> application of tens of thousands of lines, every single line of it must
> be perfect and with no warning before you can start testing.
>
Why would I want to test code that isn't as good as I can get it at the
coding stage? Why would I want to write tens of thousands of lines
without testing underway? Why would I want to write code that triggers
warnings in the first place?
You seem to imagine my development as a process of writing huge swaths
of poor quality code, then generating vast numbers of warnings, then
going back and changing the code. I don't - I only get warnings if I've
made a mistake in my coding, or while I've not yet completed a
particular part of the code.
> Including all the code you've just added, that you don't know works yet,
> and that you might have to strip out and rewrite half an hour later,
> after spending all that time to remove all possible things might give a
> warning.
>
> Some of us just work in different ways which are not necessarily wrong
> just because you don't work the same way.
You might well have a different choice of which warnings to use - some
of the warnings I use are definitely in the "style" category. That's
fair enough. But warnings are there to show you have got something
wrong - and I am sure you too aim to write correct code at the start
rather than writing a jumble.
About the only warnings I can think of where you might want to disable
them early in the development process, then enable them later on and
perhaps get a bunch of warnings is the various "unused" warnings. If
you write in a style where these are triggered often, just disable those
warnings.
>
>> I expect people writing serious code to use their tools, and write the
>> C code, in a manner far closer to the way I do than the way /you/ do.
>>
>>> But you shouldn't be so dismissive.
>>
>> Of course I should be dismissive of your messing about with compilers
>> - it is of no use to anyone until you learn to use tools properly.
>
> Excuse me. It is MY compiler that will show that error without doing
> anything at all except run it with the name of the source file as input.
> Could it get more straightforward than that?
>
> You are saying YOUR tool is superior because /you have to tell it how to
> compile programs and which errors to detect and which to ignore/? It
> sounds like it doesn't know its job! I guess you would call that
> 'flexibility', because sometimes it really doesn't matter if that rocket
> crashes.
Again, you are letting the point fly pass you in your eagerness to feel
wronged.
I have said /many/ times that I would prefer gcc to have more warnings
and stricter checking by default. It would make almost no difference to
serious developers who understand the importance of using languages and
tools correctly, but it might help some amateurs.
Yes, gcc is superior to your compiler in many ways. Better warnings and
error checking is most certainly one of them. Your tool gets a plus for
convenience by enabling some checks automatically, but that does not
outweigh the fact that gcc has many more useful checks (and other
options) that are available.
I am dismissive of your continual complaints about the problems you have
with gcc, because you fail to use it correctly despite all the help and
advice you are given. Don't you think that it is fair?
(It has been pointed out to me that repeatedly telling you this is not
helpful. That is probably correct.)
>
>> Screens of warnings for C has never been an issue with gcc,
>
> Yes, you said. You never get warnings.
You snipped the bit about "for people who can use development tools
properly".
Warnings are helpful. Huge piles of warnings are not helpful - so it is
a good idea to use development practices that don't give you mountains
of warnings. Write some code, compile it, fix any errors or warnings,
test it. Rinse and repeat. Don't write mountains of code and then
generate mountains of warnings.
And use a decent IDE. When you do a build, you will have a list of
errors, warnings, and other messages - neatly sorted. You'll have
markers in your editor windows, you can jump directly to the part of
your code that triggered the message (it is not necessarily the part
with the problem, but it's a start). Many warnings can be generated by
the IDE as you type, making it as fast as possible to see and correct
the error.
>
> So, what is the purpose in having warnings if all of them have to be
> taken seriously according to you? Do you really never see them? Or do
> you see them before they are fixed?
I see them and then fix them.
> If which case you will also get
> screenfuls of them from time to time.
That is very rare - and only in cases where I know exactly what change I
have made that caused the effect. For example, if I rename a commonly
used header file, I'd expect piles of warnings from the build due to
missing include files, undefined identifiers, and so on.
> Then what; do you print them off
> and go through them one by one and not start to actually run your
> program until they've all gone?
I don't print them - I use an IDE for most of my programming, with two
large screens. (My desk is covered in printouts of other things, paper
with notes, etc., but not for a list of warnings.) The warnings are
there in the IDE, so I can click on them to navigate to the problem if
necessary. (It is rarely necessary - with short edit/compile cycles the
warnings would most likely be in the code being worked on.)
And no, I rarely bother running my code until the warnings are fixed.
>
> (And then you find there are bugs as I suggested above.)
>
> My compiler never gives warnings. It gives errors and stops at the first
> error. I fix that and move on. Since I can't keep in mind more than one
> anyway, and I'm not going to print out a long list to go through. You
> just compile again; if there is another error, you will find out in 50
> msec.
>
Once I have got into the main part of development for a project, I also
turn all warnings into errors - I don't want to accidentally accept code
with known problems. But my tools don't stop on the first error - that
would make the whole process a good deal slower. (And before you
mention compilation speed, it is the psychological break that is the
issue, not the compile speed. If my projects were a lot bigger and full
of C++ header libraries, then the compile speed would be relevant.)