You are not logged in.

#1 2014-08-11 10:58:15

bitsdd
Member
Registered: 2014-06-26
Posts: 34

C/Objective-c and Gcc/Clang

Does anyone provide some differentiation in between them as i wondering "which one is faster??"
I got this hiccup from these topics:
https://bbs.archlinux.org/viewtopic.php?id=148055
http://llvm.org/ they are saying clang is 3x faster than gcc.
Can anyone shed some light here.


Is there any cookies because i'm all about arch arch arch....

Offline

#2 2014-08-11 11:29:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: C/Objective-c and Gcc/Clang

Faster at what, by what metric, under what conditions?  Which compiler is faster at compiling, or produces faster binaries?

As for objective-C and C, they are two completely different languages.  What differences do you want to know about?  What have you already read?  Have you use SmallTalk?  Have you looked into what that is?  Have you done anything to direct this thread in a useful direction?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2014-08-13 08:38:52

hussam
Member
Registered: 2006-03-26
Posts: 572
Website

Re: C/Objective-c and Gcc/Clang

Clang compiles faster under similar compiler flags. The binaries themselves won't operate 'faster'. GCC will likely produce binaries that operate faster.

But making sure your code compiles with both gcc and clang is good especially since clang by default catches more warnings than gcc. Keep in mind that some vendors such as Apple are using forks of LLVM/Clang in their toolchain stack. Debian is working on making sure the whole archive eventually compiles with clang but mostly for portability reasons.
Clang is also really good for cross compiling smile

Tha main advantage of llvm/clang is it is a future-ready technology although I can see gcc moving to a similar model eventually down the road.

C and Objective-C are two different languages. There is more than one compiler for both languages.

Think of LLVM as something that is pushing an area of technology in the right direction and provides tools that attract more vendors. This is similar to how a decade ago, Mozilla Firefox pushed IE towards a better direction (post IE6 initial release).

The Clang frontend to LLVM is being developed by companies such as Apple, Google and Intel.

Last edited by hussam (2014-08-13 08:40:33)

Offline

#4 2014-08-13 12:49:50

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: C/Objective-c and Gcc/Clang

Trilby wrote:

As for objective-C and C, they are two completely different languages.

That's true, but they're also pretty similar, aren't they? Objective-C is a strict superset of C, so any C code is guaranteed to be 100% valid Objective-C code. Also, don't Objective-C source files compile to C object files?

...I apologize for being pedantic. I used to have a passion for using and talking about Objective-C but we had a bad breakup. sad

Also, I just like talking about programming languages. smile

Offline

#5 2014-08-13 13:16:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: C/Objective-c and Gcc/Clang

True.  But haven't you frequenty emphasized that C and C++ are completely different languages, when the same criteria can be applied to that pairing?  I have a passion for irony wink


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2014-08-13 13:54:07

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: C/Objective-c and Gcc/Clang

Trilby wrote:

True.  But haven't you frequenty emphasized that C and C++ are completely different languages, when the same criteria can be applied to that pairing?  I have a passion for irony wink

Hah! You know me. tongue Nah, it's different to me because the amount of overlap between the languages is so different.

If C is a circle (like a Venn diagram) then Objective-C is a slightly larger circle that encompasses C entirely. C++, on the other hand, can be drawn as an enormous bloated blob with a small growth that overlaps with the circle representing C.

Another point is that, if you know Objective-C then you know C. The same cannot be true for C and C++ in either direction.

...Or maybe you're right and I'm just an idiot. In the end it doesn't really matter because I just want to program in Python. big_smile

Last edited by drcouzelis (2014-08-13 13:54:19)

Offline

#7 2014-08-13 14:52:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: C/Objective-c and Gcc/Clang

drcouzelis wrote:

Another point is that, if you know Objective-C then you know C.

Maybe - though having worked with Objective-C on a mac, that instatiation of Objective-C relies so heavily on the Cocoa API (and the Core* stuff) that everything is done through SmallTalk messages to that API even when it could be done in pure C.  So due to the completely lack of use of pure C, I suspect programmers who live in that world would be completely unprepared to write a pure C function let alone a program.

So I suppose C++ may be an enormous bloated blob, while pure Objective-C might be a little closer to C.  But Objective-C as it is frequently used (e.g. Objective-C + Cocoa + CoreGraphics + CoreSomethingelse + CoreMutherF'er) is an even more enormous bloated blob.

This does, however, raise an interesting 'philosophical' question.  To what degree is a language defined by the libraries and APIs frequently used with it.  C has the standard libraries, and C++ the standard template library (or something), but C++ also has boost, which is so frequently used it can almost be considered part of the language as much as the standard libs.  Objective-C is not the same animal as the Cocoa API, but they are (in many circumstances) very tightly intertwined - though Objective-C can be used in other contexts.  Was it Haiku that uses a lot of Objective-C, or was that C++?

Last edited by Trilby (2014-08-13 14:54:05)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2014-08-13 15:13:21

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: C/Objective-c and Gcc/Clang

Trilby wrote:

So I suppose C++ may be an enormous bloated blob, while pure Objective-C might be a little closer to C.  But Objective-C as it is frequently used (e.g. Objective-C + Cocoa + CoreGraphics + CoreSomethingelse + CoreMutherF'er) is an even more enormous bloated blob.

That's what my experience has been as well, which makes me sad because I think pure Objective-C really is a pretty language. sad Also, a lot of Objective-C now supports Objective-C++, which just makes me even sadder.

Trilby wrote:

This does, however, raise an interesting 'philosophical' question.  To what degree is a language defined by the libraries and APIs frequently used with it.  C has the standard libraries, and C++ the standard template library (or something), but C++ also has boost, which is so frequently used it can almost be considered part of the language as much as the standard libs.  Objective-C is not the same animal as the Cocoa API, but they are (in many circumstances) very tightly intertwined - though Objective-C can be used in other contexts.  Was it Haiku that uses a lot of Objective-C, or was that C++?

Yes, Haiku is written in C++.

I officially gave up on Objective-C when I discovered that pieces of code were removed from GCC so that, in order to compile Objective-C code, GNUstep is required. I don't have anything against GNUstep, I just wasn't expecting to need it in order to compile my video game. hmm

Anyway, that's why, in response to people asking which programming language they should learn, I always say it doesn't matter. Languages are easy. It's the tens of thousands of different libraries that are the tricky parts. smile

Offline

#9 2014-08-13 15:45:05

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: C/Objective-c and Gcc/Clang

drcouzelis wrote:

in response to people asking which programming language they should learn, I always say it doesn't matter. Languages are easy. It's the tens of thousands of different libraries that are the tricky parts. smile

That, sir, is a worthy quote.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#10 2014-08-14 09:46:16

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: C/Objective-c and Gcc/Clang

drcouzelis wrote:

<snip>
I officially gave up on Objective-C when I discovered that pieces of code were removed from GCC so that, in order to compile Objective-C code, GNUstep is required. I don't have anything against GNUstep, I just wasn't expecting to need it in order to compile my video game. hmm
>snip>

Would that video game be Oolite ?

If so, keep in mind that Oolite started as a Mac-only application and was later ported to linux , then windows.
Iirc correctly linux port at first didn't use GNUStep, but at some point in the distant past Oolite creator decided to use Cocoa on the Mac,
and GNUstep on linux / windows .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#11 2014-08-14 17:18:41

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: C/Objective-c and Gcc/Clang

Lone_Wolf wrote:

Would that video game be Oolite ?

No, they were my own. I wrote a few video games in Objective-C.

My most recent game has had versions of it written in Objective-C, C++, and ANSI C, sometimes with Allegro 4 and sometimes Allegro 5. I guess part of the reason it'll never get finished is because I keep changing languages and libraries. big_smile

Offline

Board footer

Powered by FluxBB