Sujet : Re: Baby X is bor nagain
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.cDate : 29. Jun 2024, 09:47:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v5ohno$3rjfp$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
On 28/06/2024 12:19, bart wrote:
On 28/06/2024 04:23, Kaz Kylheku wrote:
On 2024-06-27, bart <bc@freeuk.com> wrote:
And for most of /my/ compiles, the code produced by gcc-O0 is fast
enough. It also about the same speed as code produced by one of my
compilers.
>
So I tend to use it when I want the extra speed, or other compilers
don't work, or when a particular app only builds with that compiler.
>
Otherwise the extra overheads are not worth the bother.
>
How good are your diagnostics compared to GCC -O2, plus -Wall and -W?
Using products like tcc doesn't mean never using gcc. (Especially on Linux where you will have it installed anyway.)
>
You can use the latter to do extra, periodic checks that the simpler compiler may have missed, or to produce faster production builds.
But gcc is not needed for routine compilation.
It is certainly a reasonable idea to use gcc as a linter if your normal compile is poor at static checking. I've done that myself in the past - in embedded development, you don't always get to choose a good compiler. These days I'd be more likely to go for clang-tidy as a linter, and there's other more advanced tools available (especially if you have the money).
However, I don't see the point in doing any kind of compilation at all, until you have at least basic linting and static error checking in place. If I've used the value of a variable without initialising it, I have no interest in running the program until that is fixed. And if I don't want to run the program, I've no interest in compiling it.
So I simply can't comprehend why you'd want fast but pointless compiles regularly, then only occasionally check to see if the code is actually correct - or at least, does not contain detectable errors.
Now, if you were using one of these "big" linters that does simulations of your code and takes hours to run on a server machine before posting back a report, that's a different matter. Tools like that run overnight or in batches, integrating with version control systems, automatic test setups, and so on. But that's not what we are talking about.
Say tcc takes 0.2 seconds to compile your code, and "gcc -O2 -Wall" takes 3 seconds. If gcc catches an error that you missed, that's probably going to save you between half and hour and several days finding the problem by trial-and-error debugging.