You are not logged in.

#26 2014-01-18 17:49:43

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: C++ versus C: is C really "better"?

I hear stuff about Rust from time to time. What's its use case? I don't know anyone who actually uses it for anything, so I'm not sure whether it's supposed to live in the realm of C or C++. (Lots of people also seem to compare it to C#, which doesn't seem right to me.) It seems rather complex to be easily ported to the thousands of low-volume embedded platforms out there (same problem C++ has really), so I find it hard to imagine Rust displacing C. To say nothing of the implications of "no null pointers".

So what's it for? Games, browsers and apps, or printing presses and radar controllers?

Offline

#27 2014-01-18 18:06:17

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,093
Website

Re: C++ versus C: is C really "better"?

Trent, Rust is a language still in development (it hasn't even reached it's 1.0 release yet). It is multi-paradigm, so it actually could be used to replace C++ in many cases. I'm planning on writing a game sometime in the future and I have yet to decide which I will write it in C++ or Rust, but either, I believe would be suitable.

All the best,

-HG

Offline

#28 2014-01-18 19:38:12

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: C++ versus C: is C really "better"?

Thanks, good answer. I'm all for replacing C++ (in the few domains where it hasn't already been supplanted by HLLs). I'm not opposed to replacing C either, but I've just never seen a language that seemed good enough to do it.

I'm doing my own version of Scheme from Scratch and briefly toyed with the idea of porting it to C++ once I finish it in C. Maybe I'll do Rust instead; I got rid of my C++ book anyway.

Offline

#29 2014-01-18 20:44:16

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,093
Website

Re: C++ versus C: is C really "better"?

I don't think Rust will ever be able to replace C wholesale. If for no other reason than size. For example, the most basic "Hello, World!" program I can write in C produces a stripped binary of 725 KiB. The same program ported to Rust is 1.9MiB. It's, of course, not meant for small projects, it's designed for complex projects, but still.

Edit: I was just set straight that Rust code is compiled statically by default. So the original comparison made was unfair. It's been corrected, and the difference is significantly less noticeable, but is still pretty large.

All the best,

-HG

Last edited by HalosGhost (2014-01-18 22:24:19)

Offline

#30 2014-01-18 21:00:30

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: C++ versus C: is C really "better"?

I don't think Rust will ever be able to replace C wholesale. If for no other reason than size. For example, the most basic "Hello, World!" program I can write in C produces a stripped binary of 4.4KiB. The same program ported to Rust is 1.9MiB. It's, of course, not meant for small projects, it's designed for complex projects, but still.

Then there is that "What language is used to create other languages?" question.

Offline

#31 2014-01-19 00:35:31

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: C++ versus C: is C really "better"?

It's an interesting problem, but there's really no inevitable need for "intermediate" languages, if we determine that it's better to use a higher level language to do the task of translating from HLLs to assembly. In principle, you could write a compiler in a language like Rust, and port it to new platforms by writing a new backend -- this is already basically how gcc works, but there's no need for the compiler itself to be written in C(++), since any other compiled language would be exactly the same. If Rust (or some other language) can support a sufficiently thin abstraction layer to compete with C in other areas, there's no reason it couldn't supplant C entirely in time.

But C has proven quite resilient over the years, and is still the lingua franca of data structures and memory abstraction. Interesting, when you consider how relatively little it has changed in the last 25-30 years or so. Perhaps "intermediate-level" languages really are inevitable.

Since we were talking about C vs C++, the latter (IMO) tries too hard to straddle the gap: it's too overweight to compete with C in the intermediate-level category, and too clunky to compete with other, newer languages in the high-level category. It's the lightest wrestler in its weight division. The only roles it still clings to (except for legacy code) are those that demand both performance and scale. Maybe Rust can be C++'s competition.

(I hope OP is still entertained because this thread has drifted somewhat)

[edited for tone]

Last edited by Trent (2014-01-19 21:10:38)

Offline

#32 2014-01-25 23:43:05

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: C++ versus C: is C really "better"?

Trent wrote:

(I hope OP is still entertained because this thread has drifted somewhat)

Sure, always big_smile

I am currently reading SICP, your link to 'scheme from scratch' looks like an interesting continuation later. Are you still progressing on your project or did you go for Rust?

--

Maybe this Rust thing will be in the future what Ruby is today?

Offline

#33 2014-01-26 02:05:57

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: C++ versus C: is C really "better"?

I still intend to finish it in C. I'm only on v0.9 (Environments) and I'm taking a pretty leisurely pace, one chapter a week or so. I'll look into Rust when it's done, and maybe use that for v2.0.

I've never actually read SICP and I had no exposure to Scheme when I began. I've been making my interpreter by reading Peter's posts (not his code) and cooking up my own implementation. I have dipped into SICP a couple times to try to understand how symbol tables are related to environments (as it turns out, they aren't) but I'm still keeping eyes off the code. It's a lot of fun, but I still can't write a lick of Scheme smile

Offline

#34 2014-01-26 03:10:52

mmix
Member
Registered: 2014-01-11
Posts: 33

Re: C++ versus C: is C really "better"?

ah! there is julia. HTH
http://www.evanmiller.org/why-im-betting-on-julia.html
https://news.ycombinator.com/item?id=7109982

Julia breaks down the second wall — the wall between your high-level code and native assembly. Not only can you write code with the performance of C in Julia, you can take a peek behind the curtain of any function into its LLVM Intermediate Representation as well as its generated assembly code — all within the REPL. Check it out.

Offline

#35 2014-01-31 02:44:51

dysoco
Member
Registered: 2011-10-11
Posts: 43

Re: C++ versus C: is C really "better"?

Just to clear up.

C can be object oriented in fact, several codebases like Linux or Redis apply object-oriented concepts to their code, heck, there's even a (free, btw) book: http://www.cs.rit.edu/~ats/books/ooc.pdf

I used to be a die-hard C developer, why? it's easier to understand, it's small and simple, and an human can easily master it: you know it's irks and quirks, whereas C++ is much more complex and "retarded" in some sense.
However, I've started to appreciate C++, specially with the additions in C++11: it feels much safer to use (Smart pointers, RAII, etc.) And you get proper object orientation if you are into that kind of thing.

However, it's not for everyone nor everything: I do think C++ is very complex, and you must spend a considerable amount of time reading about it in order to be proficient with it, there are a lot of gotchas you need to be aware of, and you can easily run into a lot of pitfalls, traps and holes that will make you switch professions.

I'd like to add a quote by the great Galactic Viceroy of Research Magnificence:

When it’s 3 A.M., and you’ve been debugging for 12 hours, and you encounter a virtual static friend protected volatile
templated function pointer, you want to go into hibernation and awake as a werewolf and then find the people who
wrote the C++ standard and bring ruin to the things that they love.

source: http://research.microsoft.com/en-us/peo … twatch.pdf

Offline

#36 2014-01-31 11:18:31

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: C++ versus C: is C really "better"?

This is turning into one of those threads, isn't it? //

Offline

#37 2014-01-31 12:16:16

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: C++ versus C: is C really "better"?

Trent wrote:

This is turning into one of those threads, isn't it? //

Where C is like unicorns and C++ is like unicorns with radioactive dragon armour?

Offline

#38 2014-02-01 16:22:45

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: C++ versus C: is C really "better"?

/dev/zero wrote:
Trent wrote:

This is turning into one of those threads, isn't it? //

Where C is like unicorns and C++ is like unicorns with radioactive dragon armour?

Can't you C where this conversation is going?


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#39 2014-02-02 04:08:45

Inchw0rm
Member
Registered: 2013-05-12
Posts: 25

Re: C++ versus C: is C really "better"?

Hello there,
I'm not a software developer, but I study ICT in germany, and I also had quiet a bit experience with a few programming languages, and all I can say about this tread is bull shit... I didn't manage to read all of this stuff, but the guys in the beginning wrote some crazy crap, that I could not wai to reply. I'm sorry for my offensive maneer of expressing myself, I didn't ment to hurt anyone. Anyway...

First of all DO NOT COMPARE THEM!!!

Every programming language is unique, and has been designed to solve a variety of tasks. Take fortran for example, it's great for math and science, but try to use it for graphics... Java, another great language, runs in a virtual machine. PHP great for web programming, but is it also great for desktop applications?

The same thing is happening to C and C++, having a lot in common, they are very differrent. C is low level, C++ a little bit more high level.

The reason why many people hate C++ is that it's got strange views... C++ is aiming to support old code, and is too conservative. Therefore there are a lot of things that should not be, structures for example. Why the hell do you want to use them if you can use classes more effectively?

The conclusion to all of this is, that you definitely don't wanna start off programming with C++, it's crap, you will find it out in about 10 years of experience with C++, knowing a tiny bit of this really complex instrument. Try to learn java, it's a relly interesting and crossplatform language, allowing you to write mods for minecraft =P

One last thing I've got to add:

Bjarne Stroustrup wrote:

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.

P.S.: sorry for my bad english

Last edited by Inchw0rm (2014-02-02 04:10:13)

Offline

#40 2014-02-02 05:11:30

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

Re: C++ versus C: is C really "better"?

Inchw0rm, no need to appologize for your candor or manner - but I find it odd that you would call everyone else's posts bullshit when you admit to not actually having read them ... especially when you proceed to effectively echo what has already been said by many contributors to this thread.

I appreciate candor.  But you can keep your hypocrisy.


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

Offline

#41 2014-02-02 05:15:35

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,093
Website

Re: C++ versus C: is C really "better"?

Inchw0rm wrote:

PHP great for web programming, but is it also great for desktop applications?

PHP is a monstrosity of awful and should be avoided forever by everyone. smile

Try to learn java python, it's a really interesting and cross-platform language

Fixed that for you smile

All the best,

-HG

Offline

#42 2014-02-02 12:43:06

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: C++ versus C: is C really "better"?

I(hobbyist) like C++, some like C, some like Python, some like to use PHP for desktop software and some like to call it a monstrosity. Some, interestingly, like to use Minecraft.

But apparently, instead of writing code,  they all like writing English best, preferably in an expressive manner. tongue

Offline

#43 2014-02-22 17:05:38

kerolasa
Member
From: London, UK
Registered: 2014-02-21
Posts: 6
Website

Re: C++ versus C: is C really "better"?

There are reasons why some languages live, and others wont. Then there are languages that most agree would be nice to get rid of, but they persist being present, such as COBOL. Generally speaking the languages that are not going strong are not fit to any known purpose. Both C and C++ are very much alive, because they do certain things very well, they do fit to many purposes.  And as long there is nothing 1000 times better, or conditions of computing have sudden total change, these two languages will keep on going. Consider languages the same ways as species that are subject to evolution. In most fit to purpose schema it is a bit strange to compare a dolphin and donkey.

Offline

#44 2014-02-24 09:34:09

Janarto
Member
From: Paris
Registered: 2008-09-23
Posts: 80

Re: C++ versus C: is C really "better"?

An attempt to go beyond C and C++ is Golang

“The complexity of C++ (even more complexity has been added in the new C++), and the resulting impact on productivity, is no longer justified. All the hoops that the C++ programmer had to jump through in order to use a C-compatible language make no sense anymore — they’re just a waste of time and effort. Now, Go makes much more sense for the class of problems that C++ was originally intended to solve.”

— Bruce Eckel, author and founding member of the ANSI/ISO C++ standard committee.

“I think it goes back to the Unix C traditions back to basics and other compiled languages and it remedies other deficiencies in C, I don’t think C++ was an improvement but I do think Go is a definite improvement on C and we’ve got Kernighan and things in the background there and obviously they’ve got wonderful experience on building languages. It’s very nicely engineered and actually when it even came out impressive documentation, and all this stuff that you need. Even when it first came out it has a level of maturity that you would think would actually have been there for many years, so it is very impressive actually.”

— Joe Armstrong, co-inventor of Erlang

(from http://go-lang.cat-v.org/quotes)


In addition, language adoption, neither in daily life nor in computer programming, is not influenced by intrisic "superiority" nor "quality".
It's about usage and practicality and social trends.

Do you think about anyone suggesting replacing english by italian because it's "more elegant" or japanese by english because it's "more consise"
Would you juge a human language by the number of lines it takes to write a book ?

Last edited by Janarto (2014-02-24 09:38:25)

Offline

#45 2014-02-24 14:37:12

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

Re: C++ versus C: is C really "better"?

Today I learned "golang" == "Go". Smart move, much easier to search for on the Internet. wink

Sounds intriguing! I guess it's time for me to try out Go.

Offline

#46 2014-02-24 15:48:24

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,093
Website

Re: C++ versus C: is C really "better"?

Eh, golang does some incredibly weird things that force you to use a paritcular code style, which I find to be really annoying. At the moment Rust (drcouzelis, often called rust-lang tongue) is far more interesting to me as a replacement for C++.

All the best,

-HG

Last edited by HalosGhost (2014-02-24 15:48:42)

Offline

#47 2014-02-27 05:01:46

Diaz
Member
From: Portugal
Registered: 2008-04-16
Posts: 366

Re: C++ versus C: is C really "better"?

I'm so excited to see rust gaining a stable status and see where it is going that is almost crazy. I keep lurking the /r/rust reddit and the mailing list. With that some great discussions in the github issues and PRs. So lovely, really exciting, especially watching all happen. The last stable version is in arch repos and there's also a special repo to get the nightlys. big_smile

Offline

#48 2014-02-27 14:57:34

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: C++ versus C: is C really "better"?

To the Rust-ites: I'm curious to know why you favor Rust over D if you're at all familiar with the latter.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#49 2014-02-27 18:50:45

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,093
Website

Re: C++ versus C: is C really "better"?

alphaniner wrote:

To the Rust-ites: I'm curious to know why you favor Rust over D if you're at all familiar with the latter.

Actually, I don't necessarily mind D. I've worked with both D and Rust about the same amount of time (very little), and I'm rooting for both to do well.

All the best,

-HG

Offline

#50 2014-03-03 14:49:36

Gregosky
Member
From: UK
Registered: 2013-07-26
Posts: 174

Re: C++ versus C: is C really "better"?

10 years of coding under different platforms/languages leaves one impression (apart from obvious - pick the right tool for the right job) - programming language is not the most important thing to learn, building good quality code brings much more value. And of course "good quality" might be achieved different ways when different languages are used exactly the same way how you build grammatically correct sentences in different languages.

Another observation - time constraint. It's easier to build something functional with some languages whereas building the same thing with other will take 10 times more (somebody above suggested using python which seems to be very good choice for prototyping and rapid development).

Oh, and I know people who write everything in ASM (yes, GUI applications too). So paraphrasing for some people it seems it's not impossible to use screwdriver to build a car :-)

Last edited by Gregosky (2014-03-03 14:57:52)

Offline

Board footer

Powered by FluxBB