Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GCC vs Clang

141 views
Skip to first unread message

The Doctor

unread,
Jul 22, 2016, 1:29:46 PM7/22/16
to
Which is the better compiler?

Also are there any toher C / C++ compilers?


--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.me/rootnl2k Look at Psalms 14 and 53 on Atheism
Language is the source of misunderstandings. -Antoine de Saint-Exupery

Luuk

unread,
Jul 22, 2016, 2:17:57 PM7/22/16
to
On 22-07-16 19:29, The Doctor wrote:
> Which is the better compiler?
>
> Also are there any toher C / C++ compilers?
>
>

http://www.thefreecountry.com/compilers/cpp.shtml

jacobnavia

unread,
Jul 22, 2016, 3:09:47 PM7/22/16
to
Le 22/07/2016 à 19:29, The Doctor a écrit :
> Which is the better compiler?
>
> Also are there any toher C / C++ compilers?
>
>

A free C compiler for windows platforms:

http://www.cs.virginia.edu/~lcc-win32

64 bit compiler (C99 mostly) with 128 bit integers, many extra numeric
types like qfloats (480 bit floats) bignums, etc

Fast compiler but approx 60-70% of fully optimized gcc only.

Source code available at request (not free)
Compiler binaries are free.

jacob

Jens Stuckelberger

unread,
Jul 22, 2016, 4:42:25 PM7/22/16
to
On Fri, 22 Jul 2016 17:29:45 +0000, The Doctor wrote:

> Which is the better compiler?

Cats or dogs, which is better? Even better, let's dicuss which is
better, the Republicans or the Democrats, Islam or Christianity, so we
can have a more thorough bloodbath.

jacobnavia

unread,
Jul 22, 2016, 5:09:12 PM7/22/16
to
????

We can discuss code generation speed, compilation speed, ease of use,
features, licenses, many things.

Look, compilers aren't religions, or pets, or things "you believe in".
Somehow we CAN be reasonable people and dicuss things in a civilized manner.

Personally I do not see much difference between the two, but it is just
my opinion.


BartC

unread,
Jul 22, 2016, 5:18:25 PM7/22/16
to
On 22/07/2016 18:29, The Doctor wrote:
> Which is the better compiler?

My experience of using Clang is that it is not complete: it assumes a
gcc installation (so that it can make use of gcc's header files and
possibly libraries too).

So if you could only install one, gcc would make more sense...

--
Bartc

Richard Bos

unread,
Jul 23, 2016, 5:55:03 AM7/23/16
to
The Doctor <doc...@doctor.nl2k.ab.ca> wrote:

> Which is the better compiler?

Not touching that with a bargepole.

> Also are there any toher C / C++ compilers?

You don't specify which platform you use, so you probably mean MS
Windows, in which case:

Pelle's C: <http://www.smorgasbordet.com/pellesc/>
Complete development environment, _actual_ freeware.

Others exist for other platforms (I just found out about ACK, but
haven't used it).

Generally speaking, many platforms have a port of LCC and TCC.

Richard

Richard Heathfield

unread,
Jul 23, 2016, 2:53:01 PM7/23/16
to
On 22/07/16 21:42, Jens Stuckelberger wrote:
> On Fri, 22 Jul 2016 17:29:45 +0000, The Doctor wrote:
>
>> Which is the better compiler?
>
> Cats or dogs, which is better?

Cats. Lower maintenance requirements, and far less slobbery.

--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Richard Bos

unread,
Jul 23, 2016, 3:50:26 PM7/23/16
to
Richard Heathfield <r...@cpax.org.uk> wrote:

> On 22/07/16 21:42, Jens Stuckelberger wrote:
> > On Fri, 22 Jul 2016 17:29:45 +0000, The Doctor wrote:
> >
> >> Which is the better compiler?
> >
> > Cats or dogs, which is better?
>
> Cats. Lower maintenance requirements, and far less slobbery.

But they murder songbirds (and have even driven some to extinction), and
are therefore Evil.

AFAIAA neither gcc nor clang has ever killed a bird. Not even a penguin.

Richard

David Brown

unread,
Jul 25, 2016, 7:31:36 AM7/25/16
to
If you are using an OS that does not include basic OS headers and
libraries, then you will need to install those along with your compiler.
Neither clang nor gcc provide these. There are /packages/ for Windows
that include gcc, headers, libraries, an assembler, linker, and other
useful utilities. If there are no such pre-made packages for clang for
Windows, then perhaps installing a gcc package first is a convenient way
to handle installation of clang on Windows. Remember, gcc and clang are
compilers - they are only /part/ of a C (or C++) implementation.


However, the OP is posting from a *nix system - FreeBSD, according to
the post's headers. He will therefore have all the headers and
libraries he needs, either installed already or just a "pkg install" away.


BartC

unread,
Jul 25, 2016, 10:14:21 AM7/25/16
to
On 25/07/2016 12:31, David Brown wrote:
> On 22/07/16 23:18, BartC wrote:
>> On 22/07/2016 18:29, The Doctor wrote:
>>> Which is the better compiler?
>>
>> My experience of using Clang is that it is not complete: it assumes a
>> gcc installation (so that it can make use of gcc's header files and
>> possibly libraries too).
>>
>> So if you could only install one, gcc would make more sense...
>>
>
> If you are using an OS that does not include basic OS headers and
> libraries, then you will need to install those along with your compiler.

Huh? How is a beginner supposed to know anything about that? They will
expect a C compiler to come with everything needed to compile C programs
into something that can be run.

Pelles C includes everything. lccwin32 includes everything. Digital Mars
C includes everything. Tiny C includes everything. The MSVC I bought
years ago including everything.

Until you come to gcc which just has to be different, just to make life
simpler for everyone!. But even there, if you've chosen the right
download package, everything needed is also there.

And then you come to Clang (for Windows, as are all my examples). Which,
for a start, gives no indication whatsoever that it does have a dependency.

Nor that that dependency is on anything other than specifically gcc.
Very puzzling after you've completed a 400MB installation; surely that
lot must have included everything /including/ the kitchen sink!

If I 'hide' my gcc installation, then Clang stops working. Despite there
being four other C compilers around.

> Neither clang nor gcc provide these. There are /packages/ for Windows
> that include gcc, headers, libraries, an assembler, linker, and other
> useful utilities. If there are no such pre-made packages for clang for
> Windows, then perhaps installing a gcc package first is a convenient way
> to handle installation of clang on Windows. Remember, gcc and clang are
> compilers - they are only /part/ of a C (or C++) implementation.

Blah blah ... No beginner wants to know about this stuff. They want
something that Just Works. They are not interested in the fine
distinctions between a compiler, includes, libraries and utilities.

Even a non-beginner who has spent years using integrated packages would
be surprised that some compilers are split up into separate parts. (Like
buying a new car but having to source the engine and the wheels
separately. And not actually being told that so being surprised because
you're used to cars having those included.)

> However, the OP is posting from a *nix system - FreeBSD, according to
> the post's headers. He will therefore have all the headers and
> libraries he needs, either installed already or just a "pkg install" away.

In that case he's got no problems because Unix users like to have their
hands held (the opposite to what is usually claimed).

--
Bartc

David Brown

unread,
Jul 25, 2016, 10:57:21 AM7/25/16
to
On 25/07/16 16:14, BartC wrote:
> On 25/07/2016 12:31, David Brown wrote:
>> On 22/07/16 23:18, BartC wrote:
>>> On 22/07/2016 18:29, The Doctor wrote:
>>>> Which is the better compiler?
>>>
>>> My experience of using Clang is that it is not complete: it assumes a
>>> gcc installation (so that it can make use of gcc's header files and
>>> possibly libraries too).
>>>
>>> So if you could only install one, gcc would make more sense...
>>>
>>
>> If you are using an OS that does not include basic OS headers and
>> libraries, then you will need to install those along with your compiler.
>
> Huh? How is a beginner supposed to know anything about that? They will
> expect a C compiler to come with everything needed to compile C programs
> into something that can be run.

I have no idea what /you/ are supposed to know about. I /do/ know that
most OS's include assemblers, linkers, libraries, and headers (and
usually compilers too) as part of their basic packaging - Windows is
fairly unique in not doing so. I also know that some compiler
manufacturers - gcc and clang being prime examples - make compilers, not
development suites or even complete C implementations.

It is such a long time since I was a beginner with C that it is hard to
be sure how someone might approach the issue. But I would imagine that
someone starting with a bare Windows system who wants to use clang for C
compilation would first start out by googling. It should not take long
to see that clang is distributed as part of modern MS Visual Studio, and
that would seem like the easiest way to get the compiler along with an
IDE, headers, libraries, etc. Other suggestions that come up quite
quickly are instructions for compiling llvm and clang (presumably your
scared newbie would skip those), and projects like msys2 (which will
include all the other bits and pieces needed).

Newbies with any most other OS's would simply look up clang with their
distribution's package manager, and that would install any missing files
or programs automatically.

>
> Pelles C includes everything. lccwin32 includes everything. Digital Mars
> C includes everything. Tiny C includes everything. The MSVC I bought
> years ago including everything.

Those are not compilers - they are development suites of which a
compiler is one part.

Now, it is an understandable mistake to think that clang or gcc are the
same sort of thing as these tools - but it is a mistake. Their
websites, or at least their "getting started" information could no doubt
be more helpful here.

>
> Until you come to gcc which just has to be different, just to make life
> simpler for everyone!. But even there, if you've chosen the right
> download package, everything needed is also there.
>
> And then you come to Clang (for Windows, as are all my examples). Which,
> for a start, gives no indication whatsoever that it does have a dependency.
>
> Nor that that dependency is on anything other than specifically gcc.
> Very puzzling after you've completed a 400MB installation; surely that
> lot must have included everything /including/ the kitchen sink!
>
> If I 'hide' my gcc installation, then Clang stops working. Despite there
> being four other C compilers around.
>
>> Neither clang nor gcc provide these. There are /packages/ for Windows
>> that include gcc, headers, libraries, an assembler, linker, and other
>> useful utilities. If there are no such pre-made packages for clang for
>> Windows, then perhaps installing a gcc package first is a convenient way
>> to handle installation of clang on Windows. Remember, gcc and clang are
>> compilers - they are only /part/ of a C (or C++) implementation.
>
> Blah blah ... No beginner wants to know about this stuff. They want
> something that Just Works. They are not interested in the fine
> distinctions between a compiler, includes, libraries and utilities.

I am not trying to sell you anything here - I am just telling you the
facts. If you want to campaign on behalf of all these "beginners" who
want to program in C on Windows, specifically using gcc or clang, and
want something that "just works", then feel free to do so. I should
expect you could put together binary packages for clang and gcc, along
with libraries, include files, a debugger, and an IDE, all within a
single installer file. I don't even think it would be a huge effort
(though testing it all on different versions of Windows might be a
pain). But please stop making it look as though this is the fault of
gcc, or the fault of clang, or fault of people in this newsgroup.

>
> Even a non-beginner who has spent years using integrated packages would
> be surprised that some compilers are split up into separate parts. (Like
> buying a new car but having to source the engine and the wheels
> separately. And not actually being told that so being surprised because
> you're used to cars having those included.)
>
>> However, the OP is posting from a *nix system - FreeBSD, according to
>> the post's headers. He will therefore have all the headers and
>> libraries he needs, either installed already or just a "pkg install"
>> away.
>
> In that case he's got no problems because Unix users like to have their
> hands held (the opposite to what is usually claimed).
>

*nix users usually like convenience as much as any other users. I
/have/ compiled gcc from source (for a number of different target
processors), as well as finding, building and installing the appropriate
libraries and headers. But it is a lot faster and easier to use
ready-made packages when they are available.


BartC

unread,
Jul 25, 2016, 12:24:24 PM7/25/16
to
On 25/07/2016 15:57, David Brown wrote:
> On 25/07/16 16:14, BartC wrote:

>> Pelles C includes everything. lccwin32 includes everything. Digital Mars
>> C includes everything. Tiny C includes everything. The MSVC I bought
>> years ago including everything.
>
> Those are not compilers - they are development suites of which a
> compiler is one part.
>
> Now, it is an understandable mistake to think that clang or gcc are the
> same sort of thing as these tools - but it is a mistake.

On whose part? The mistake I think is for those products not to make it
absolutely clear what they are, what they do and what they need.

Their
> websites, or at least their "getting started" information could no doubt
> be more helpful here.

Clang's getting started page is about building it from sources.

The download page is simply a list of links. For Windows pre-built
binaries, it's just a link to an exe file. If there is any useful
information of the kind I've had to discover the hard way, then I
haven't found it yet.

A lot of the info is also to do with LLVM, an aspect that is unlikely to
be of interest, or be meaningful, to either beginners or those wanting
to try a new compiler.

If you suggest using Visual Studio in order to use clang, then it might
be worth bearing in mind that VS is a behemoth that can be 100 to 200
times the size of the Clang download, not itself lightweight.

>> No beginner wants to know about this stuff. They want
>> something that Just Works. They are not interested in the fine
>> distinctions between a compiler, includes, libraries and utilities.
>
> I am not trying to sell you anything here - I am just telling you the
> facts. If you want to campaign on behalf of all these "beginners" who
> want to program in C on Windows, specifically using gcc or clang, and
> want something that "just works", then feel free to do so. I should
> expect you could put together binary packages for clang and gcc, along
> with libraries, include files, a debugger, and an IDE, all within a
> single installer file. I don't even think it would be a huge effort
> (though testing it all on different versions of Windows might be a
> pain). But please stop making it look as though this is the fault of
> gcc, or the fault of clang, or fault of people in this newsgroup.

The problem is those packages are very large and complex. If I was in
charge, I would want to eliminate 99% of them just to get started. That
is not going to happen.

>> In that case he's got no problems because Unix users like to have their
>> hands held (the opposite to what is usually claimed).

> *nix users usually like convenience as much as any other users. I
> /have/ compiled gcc from source (for a number of different target
> processors), as well as finding, building and installing the appropriate
> libraries and headers.

My own compiler (static source code to native code), can be fully
re-compiled (source to bytecode) in about 0.03 seconds (it was 2 seconds
last time this was discussed; I've been busy).

How long does gcc take to compile again? See, I /know/ how to keep
things small, simple, fast and very easy for users. Many seem to have
forgotten.

BTW to get that 0.03 seconds involved targeting C (for the bytecode
compiler project source) and running gcc -03 on it.

If I relied only on my toy language, it would take 0.04 seconds.

So as far as I'm concerned, the difference between gcc and my project is
0.01 seconds less runtime; 33% extra performance. gcc however is a
considerably more massive project.

--
Bartc


0 new messages