Can anyone offer more insight into this issue?
Basically, which compiler is truly "better?"
All I know is that libllvm is _huge_ and I've worked hard to avoid
installing it on systems that I try to keep small. That sort of
bloat really annoys me.
According to these speed benchmarks of different libraries built
with GCC and Clang, they're about evenly matched overall, but in
some specific cases one can be significantly faster than the other:
https://www.phoronix.com/review/gcc-16-vs-clang-22
I should have, but I have never seriously researched the differencesClang whines alot on perfectly good code, but some of the graphics stuff requires it. I think Mesa and also AMD ROCm. They have a special
and advantages/disadvantages of the GNU Compiler Collection (GCC)
versus the LLVM/Clang compiler (only the C compiler interests me).
Basically, which compiler is truly "better?"Use case of course. But you knew that already.
Rarely, I've had some things not build with GCC that did build with
Clang. With today's disk sizes, it's easy to keep both handy.
Clang whines alot on perfectly good code, but some of the graphics
stuff requires it. I think Mesa and also AMD ROCm.
On Sat, 31 Oct 2026 10:30:39 -0400, jayjwa wrote:
Clang whines alot on perfectly good code, but some of the graphics
stuff requires it. I think Mesa and also AMD ROCm.
Why Clang and not GCC?
Because those companies are afraid of the GPL, aren?t they?
On Sat, 31 Oct 2026 10:30:39 -0400, jayjwa wrote:
Clang whines alot on perfectly good code, but some of the graphics
stuff requires it. I think Mesa and also AMD ROCm.
Why Clang and not GCC?
Because those companies are afraid of the GPL, aren?t they?
On Sun, 01 Nov 2026 00:39:59 +0000, Nuno Silva wrote:
On 2026-10-31, Lawrence D?Oliveiro wrote:
On Sat, 31 Oct 2026 10:30:39 -0400, jayjwa wrote:
Clang whines alot on perfectly good code, but some of the graphics
stuff requires it. I think Mesa and also AMD ROCm.
Why Clang and not GCC?
Because those companies are afraid of the GPL, aren?t they?
Didn't a recent post to this group suggest Apple invested in clang+llvm
because of absurd "fear" of GPLv3?
I wouldn't call it fear. Apple initially attempted to use ggc as the front end to llvm. There was little interest in the gcc maintainers to support Objective C so Apple would have had to modify gcc, taking a big bite out
of the poisoned apple.
Which is more free, one of the many permissive licenses or GPLv3?
Also install 'TCC' - which
is suprisingly good and creates more compact
code more quickly - but don't expect the more
'esoteric' libraries.
I should have, but I have never seriously researched the differences
and advantages/disadvantages of the GNU Compiler Collection (GCC)
versus the LLVM/Clang compiler (only the C compiler interests me).
All of my GNU/Linux systems are built using GCC. It has good
hardware optimization options, Link Time Optimization (LTO), and
even, if desired, Profile Guided Optimization (PGO).
But LLVM/Clang has been around for a long while as an alternative
C compiler. I have never used LLVM/Clang but others will claim
benefits and advantages.
To me, LLVM/Clang seems limited compared to GCC, especially in terms
of SIMD hardware support, but that assessment is based on incomplete knowledge.
Can anyone offer more insight into this issue?
Basically, which compiler is truly "better?"
Leroy H wrote this screed in ALL-CAPS (fixed):
I should have, but I have never seriously researched the differences
and advantages/disadvantages of the GNU Compiler Collection (GCC)
versus the LLVM/Clang compiler (only the C compiler interests me).
All of my GNU/Linux systems are built using GCC. It has good
hardware optimization options, Link Time Optimization (LTO), and
even, if desired, Profile Guided Optimization (PGO).
But LLVM/Clang has been around for a long while as an alternative
C compiler. I have never used LLVM/Clang but others will claim
benefits and advantages.
To me, LLVM/Clang seems limited compared to GCC, especially in terms
of SIMD hardware support, but that assessment is based on incomplete
knowledge.
Can anyone offer more insight into this issue?
Basically, which compiler is truly "better?"
My recent projects are set up to use either one. Clang seems to be
the "native" compiler on FreeBSD. GCC and Clang seem to me to be
comparable and somewhat supporting the same options. Clang seems
to increment versions more frequently. It finds some issues that
g++ does not find, and g++ finds some issues that clang++ does
not. They're roughly comparable in speed if cache is dropped
between builds.
As far as hardware support and C go, I have nothing to add.
So sue me.
c186282 <c186282@nnada.net> writes:
[...]
Also install 'TCC' - which
is suprisingly good and creates more compact
code more quickly - but don't expect the more
'esoteric' libraries.
Why would using tcc not give you access to "esoteric" libraries?
On 11/1/26 05:16, Keith Thompson wrote:
c186282 <c186282@nnada.net> writes:
[...]
Also install 'TCC' - whichWhy would using tcc not give you access to "esoteric" libraries?
is suprisingly good and creates more compact
code more quickly - but don't expect the more
'esoteric' libraries.
They don't come "in the package". You can
always tweak and add-on later of course.
Anyway, most tools center on GCC or Clang
these days. Still use TCC sometimes if I'm
writing a short utility however.
c186282 <c186282@nnada.net> writes:
On 11/1/26 05:16, Keith Thompson wrote:
c186282 <c186282@nnada.net> writes:
[...]
Also install 'TCC' - whichWhy would using tcc not give you access to "esoteric" libraries?
is suprisingly good and creates more compact
code more quickly - but don't expect the more
'esoteric' libraries.
They don't come "in the package". You can
always tweak and add-on later of course.
Anyway, most tools center on GCC or Clang
these days. Still use TCC sometimes if I'm
writing a short utility however.
(Why do you indent your original text in your posts? I find it
distracting.)
They typically don't come "in the package" with gcc either.
For Windows, gcc is typically installed via a package that includes
the compiler along with a number of libraries. In that context,
a tcc-based installer might not include the same libraries as a
gcc-based instaler.
For Linux-based and other Unix-like systems, it's more common
for libraries to be installed separately. For example, on my
Ubuntu system the "gcc" command is provided by the "gcc" package,
but the GNU MP bignum library is provided by the libgmp10 and
libgmp-dev packages. If I have a C program that depends on GNU
MP, I can build it with gcc, clang, or tcc.
On 11/1/26 23:25, Keith Thompson wrote:
c186282 <c186282@nnada.net> writes:
On 11/1/26 05:16, Keith Thompson wrote:(Why do you indent your original text in your posts? I find it
c186282 <c186282@nnada.net> writes:
[...]
Also install 'TCC' - whichWhy would using tcc not give you access to "esoteric" libraries?
is suprisingly good and creates more compact
code more quickly - but don't expect the more
'esoteric' libraries.
They don't come "in the package". You can
always tweak and add-on later of course.
Anyway, most tools center on GCC or Clang
these days. Still use TCC sometimes if I'm
writing a short utility however.
distracting.)
That's "MY STYLE". Live with it. Keeps it more
plain what others say, what I say. Also like
'random' capitalization and odd punctuation
to kind-of emulate 'natural speaking'. You do
it your way, I'll do it mine, and we'll all
get there together.
They typically don't come "in the package" with gcc either.
For Windows, gcc is typically installed via a package that includes
the compiler along with a number of libraries. In that context,
a tcc-based installer might not include the same libraries as a
gcc-based instaler.
Correct. As per the 'tiny' bit, it's "cut down".
Has MOST of what you'll need, good enough for a
lot of stuff, but if you're doing "cutting edge"
then go with the bigger compilers and their libs.
For Linux-based and other Unix-like systems, it's more common
for libraries to be installed separately. For example, on my
Ubuntu system the "gcc" command is provided by the "gcc" package,
but the GNU MP bignum library is provided by the libgmp10 and
libgmp-dev packages. If I have a C program that depends on GNU
MP, I can build it with gcc, clang, or tcc.
Yea, it all gets bigger and deeper deeper deeper ...
Does it HAVE to be thus ???
Just one of the reasons I mostly use Python
these days ... "just works" ... though you
still have to install libs. A "Python EVERYTHING"
meta-package would be nice.
Ah, was complaining about a re-install of a
dedicated unit/app the other day, kept crashing
after x-minutes. TWO things - it pings somewhere
every so often to make sure it's still a good
connection and ends the pgm if there's no
response after x tries. The ping address is
in a config file. First, had the wrong address
in the config file. Second, it's actually
FPING and I didn't install it :-)
Details details ........
You can indicate that you posted something by identifying it in the
headers. If you think you're important enough to use a different
layout to tell us it's you, you're mistaken.
c186282 <c186282@nnada.net> writes:Just think of it as "Python Style" :-)
On 11/1/26 23:25, Keith Thompson wrote:
(Why do you indent your original text in your posts? I find it
distracting.)
That's "MY STYLE". Live with it. Keeps it more
plain what others say, what I say. Also like
'random' capitalization and odd punctuation
to kind-of emulate 'natural speaking'. You do
it your way, I'll do it mine, and we'll all
get there together.
Of course I'll live with it. I might do so by ignoring you.
On 11/2/26 02:06, Keith Thompson wrote:
c186282 <c186282@nnada.net> writes:
On 11/1/26 23:25, Keith Thompson wrote:
(Why do you indent your original text in your posts? I find it
distracting.)
That's "MY STYLE". Live with it. Keeps it more
plain what others say, what I say. Also like
'random' capitalization and odd punctuation
to kind-of emulate 'natural speaking'. You do
it your way, I'll do it mine, and we'll all
get there together.
Of course I'll live with it. I might do so by ignoring you.
Just think of it as "Python Style" :-)
On 2026-11-01, Chris Ahlstrom wrote:
Leroy H wrote this screed in ALL-CAPS (fixed):
I should have, but I have never seriously researched the differences
and advantages/disadvantages of the GNU Compiler Collection (GCC)
versus the LLVM/Clang compiler (only the C compiler interests me).
All of my GNU/Linux systems are built using GCC. It has good
hardware optimization options, Link Time Optimization (LTO), and
even, if desired, Profile Guided Optimization (PGO).
But LLVM/Clang has been around for a long while as an alternative
C compiler. I have never used LLVM/Clang but others will claim
benefits and advantages.
To me, LLVM/Clang seems limited compared to GCC, especially in terms
of SIMD hardware support, but that assessment is based on incomplete
knowledge.
Can anyone offer more insight into this issue?
Basically, which compiler is truly "better?"
My recent projects are set up to use either one. Clang seems to be
the "native" compiler on FreeBSD. GCC and Clang seem to me to be
comparable and somewhat supporting the same options. Clang seems
to increment versions more frequently. It finds some issues that
g++ does not find, and g++ finds some issues that clang++ does
not. They're roughly comparable in speed if cache is dropped
between builds.
When you say "find issues" you mean merely in warning outputs or in differences owing to UB, or are you using their static analyzers?
c186282 <c186282@nnada.net> writes:
Ah, was complaining about a re-install of a
dedicated unit/app the other day, kept crashing
after x-minutes. TWO things - it pings somewhere
every so often to make sure it's still a good
connection and ends the pgm if there's no
response after x tries. The ping address is
in a config file. First, had the wrong address
in the config file. Second, it's actually
FPING and I didn't install it :-)
Details details ........
But not enough details (like the name of the app) for anyone to
help you.
Nuno Silva wrote this screed in ALL-CAPS (fixed):
On 2026-11-01, Chris Ahlstrom wrote:
<snip>When you say "find issues" you mean merely in warning outputs or in
differences owing to UB, or are you using their static analyzers?
Just looking at warnings.
Using "ninja scan-build" just now to see what happens.
On 11/1/26 23:25, Keith Thompson wrote:
(Why do you indent your original text in your posts?ÿ I find it
distracting.)
That's "MY STYLE". Live with it. Keeps it more plain what others
say, what I say. Also like 'random' capitalization and odd
punctuation to kind-of emulate 'natural speaking'. You do it your
way, I'll do it mine, and we'll all get there together.
(Why do you indent your original text in your posts? I find it
distracting.)
On 2026-11-02 07:52, c186282 wrote:
On 11/1/26 23:25, Keith Thompson wrote:
(Why do you indent your original text in your posts?ÿ I find it
distracting.)
That's "MY STYLE". Live with it. Keeps it more plain what others
say, what I say. Also like 'random' capitalization and odd
punctuation to kind-of emulate 'natural speaking'. You do it your
way, I'll do it mine, and we'll all get there together.
Done. :-)
On Sun, 01 Nov 2026 20:25:35 -0800, Keith Thompson wrote:
(Why do you indent your original text in your posts? I find it
distracting.)
Ha, ha, ha, ha, ha, ha! What a fucking fuddy-duddy!
If this were an actual public, and not virtual, meeting
place, people would be putting itching powder on your
stuffy skin.
<https://en.wikipedia.org/wiki/Itching_powder>
You are an unbelievable, tasteless throwback.
Ha, ha, ha, ha, ha, ha, ha, ha!
On 11/2/26 18:01, Leroy H wrote:
On Sun, 01 Nov 2026 20:25:35 -0800, Keith Thompson wrote:
(Why do you indent your original text in your posts? I find it
distracting.)
You are an unbelievable, tasteless throwback.
Aww ... give him a break.
On Mon, 2 Nov 2026 14:18:27 -0500, Chris Ahlstrom wrote:
It found a few issues in a couple of my projects, a few issues
important.
There is one that I don't get
subprojects/libcfg66/src/util/filefunctions.cpp:1138:33: warning:
Memory allocated by 'new[]' should be deallocated by 'delete[]',
not 'getline()' [unix.MismatchedDeallocator]
1138 | ssize_t count { getline(&destination, &maxim, input) };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I guess I need to use malloc() instead.
Did you allocate destination with new? getline will malloc a buffer if you pass in NULL.
rbowman wrote this screed in ALL-CAPS (fixed):
On Mon, 2 Nov 2026 14:18:27 -0500, Chris Ahlstrom wrote:
It found a few issues in a couple of my projects, a few issues
important.
There is one that I don't get
subprojects/libcfg66/src/util/filefunctions.cpp:1138:33: warning:
Memory allocated by 'new[]' should be deallocated by 'delete[]',
not 'getline()' [unix.MismatchedDeallocator]
1138 | ssize_t count { getline(&destination, &maxim, input) };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I guess I need to use malloc() instead.
Did you allocate destination with new? getline will malloc a buffer
if you pass in NULL.
Yes, and I know that from the man page.
The point is scan-build complaining about something getline() will
not do in the given use case.
A limitation of static analysis, perhaps.
c186282 <c186282@nnada.net> writes:
Correct. As per the 'tiny' bit, it's "cut down". Has MOST of what
you'll need, good enough for a lot of stuff, but if you're doing
"cutting edge" then go with the bigger compilers and their libs.
You seem to be ignoring the fact that compilers (gcc, clang, tcc) are compilers, and do not include most libraries.
Perhaps you have an example of a library that you can use with gcc
and clang but can't use with tcc.
Chris Ahlstrom <OFeem1987@teleworm.us> writes:
rbowman wrote this screed in ALL-CAPS (fixed):
On Mon, 2 Nov 2026 14:18:27 -0500, Chris Ahlstrom wrote:
It found a few issues in a couple of my projects, a few issues
important.
There is one that I don't get
subprojects/libcfg66/src/util/filefunctions.cpp:1138:33: warning:
Memory allocated by 'new[]' should be deallocated by 'delete[]',
not 'getline()' [unix.MismatchedDeallocator]
1138 | ssize_t count { getline(&destination, &maxim, input) };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I guess I need to use malloc() instead.
Did you allocate destination with new? getline will malloc a buffer
if you pass in NULL.
Yes, and I know that from the man page.
The point is scan-build complaining about something getline() will
not do in the given use case.
A limitation of static analysis, perhaps.
There?s not enough context to give a completely definitive answer, but:
1) Heap memory can be managed with new/delete, or with
malloc/realloc/free, but not both. The consequences of playing
mix-and-match vary between platform, so you might get away with it in
some cases, by luck, but static analysis tools will consider it a
bug, if they?re smart enough to notice.
2) In getline(), if *lineptr!=NULL then it will call realloc() on it if
the line from stream needs more than *n bytes (using argument names
from [1]). So passing a pointer allocated with new to it is a bug,
for the reasons given in (1) above.
3) The diagnostic referring to deallocation reather than realloc is
probably a (trivial) bug in the tool - for example it may model
realloc as malloc+free, which isn?t unreasonable as such, but leads
to an opaque diagnostic.
The only case where it would not be a bug is if the line read by
getline() can never possibly exceed the initial allocation. Whether this
is true in your use case I don?t know, but your static analysis tool
either couldn?t prove that it was or more likely, isn?t equipped to do
so.
[1] https://man7.org/linux/man-pages/man3/getline.3.html
I will not play at tug o' war. I'd rather play at hug o' war,
Where everyone hugs Instead of tugs,
Where everyone giggles And rolls on the rug,
Where everyone kisses, And everyone grins,
And everyone cuddles, And everyone wins.
-- Shel Silverstein, "Hug o' War"
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 5 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 498677:21:12 |
| Calls: | 212 |
| Calls today: | 3 |
| Files: | 910 |
| D/L today: |
31 files (22,593K bytes) |
| Messages: | 69,826 |