C vs C++ - your opinion.

kpedersen said:
C++/clr (Microsoft's C++ .NET) is actually pretty decent.. it is a shame mono doesn't have this because it seems that Microsoft is going to drop it once C# becomes better at handling native libraries.
Which is a reason why anyone wanting to use Windows languages could be exposing an Achille's heel making Mono, and therefore C#/.NET stuff, a dangerous road to follow.
I know that .NET isn't a language, however it refers to a set of languages and most people are comfortable with just saying .NET to refer to them as a group.
Not to get off track or stir up the pot but I, too, have a problem with people trying to lump everything under the .NET banner because some of those languages have nothing to do with .NET at all.
 
C++/CLI or C++/CLR whatever it is called is indeed a second class citizen on .NET. It was introduced for C++ developers to pick up .NET library. Even I've used it.

With Windows 8, MS is going back to C++ as the primary language for development. As, kpederson pointed out its shortcoming, hence the furious back paddling.

However, to be fair, .NET is an excellent framework. And the best part is that the CLR specs are ECMA standards, which means contrary to FOSS opinion it is not tied to MS anymore.

Back to topic.

Few days ago Qt was bought out by Digia and their immediate goals are port for iOS and Android with more R&D for desktop (Nokia had begun to sideline desktop towards the end of its Qt ownership).

So, C++ is there with Windows, iOS, OSX, Android and Linux (X11 port). This where the market is moving.
 
drhowarddrfine said:
See, those points are the exact opposite of what I've ever heard. Torvalds specifically talks about that in his piece.

I spoke about this as the third dimension of the problem. You can not blame a tool for how it is used. You can use C++ to elegantly slice the different parts of drivers into seperate classes and provide an easy way to create new drivers, specialized drivers, ... but all that can also become a complete trainwreck if you happen to have a certain amount of clueless developers on the team. And with C++, is is much easier to produce such wrecks as compared with C as you have more degrees of freedom to screw up and more power to lang that punch.

And while torvalds may be a skilled C programmer, I yet have to see some C++ code from him where it is demonstrated that he actually knows what he is talking about.

Lucy has some interesting points for this, using MacOS X as the example.
 
drhowarddrfine said:
In his rant, he says they tried using C++ before.

He just doesn't know how to use C++. As flexible as C++ is, you can easily wall yourself in with the wrong design approach. Also, having come from C, I know first hand that you can't really approach problems with the same mindset as a C programmer.

As much as I despise them, established C++ design patterns do help prevent you from walling yourself into a bad design. These types of patterns aren't very intuitive either. Don't believe me? Go read about some of these design patterns for yourself. As abstract and useless as they might appear, they're actually used quite universally in projects like Qt, Clang and Firefox (to name a few).
 
drhowarddrfine said:
In his rant, he says they tried using C++ before.

As I wrote : "I yet have to see some C++ code from him where it is demonstrated that he actually knows what he is talking about."

No offense, I pull my hat when it comes to herding cats in front of Linus for what he does to manage the kernel. He also seems quite competent at C, but it may be a bit hard to spot code which is 100% from him in the kernel. I frankly tell that I did not take the time to dig some of it out. But upto now, his position about C++ is about as scientifically proven as mine regarding ruby. Tried it, did not understand it immediately, therefore most likely misused it and failed. But I am open minded enough not to blame ruby for my not liking it, and I am a bit offended that a person which seems competent and intelligent to me does not consider the possibility that he may himself be at fault.

So, when it comes to Linus, let's file his rant under "using screwdriver as a hammer" but not under "reviewed research".

The question 'C or C++' (let alone Java, Lisp, Fortran or Cobol) can not be answered without knowing what the exact problem is and who is going to be doing the programming. Someone who is competent in Pascal but not Java, I would allow to use Pascal if no big arguments to the contrary are present. So, let Linus use C for all he wants as long as he get's it done without creating unmaintainable nightmares. But that does not mean that this is a rule which suddenly appeared on some stone atop some mountain.
 
UNIXgod said:
What's the difference from c++ to objective . Is it just another superset of C or is there any specific feature or paradigm that differs from c++?

What's the difference from c++ to objective . Is it just another superset of C or is there any specific feature or paradigm that differs from c++?

I understand that, Objective-C it is real heir C, but that object oriented language. C++ - object oriented language too, but it is a separate language, let's say: like C but not heir C.

As I understand, for example:
Code:
     +-----+           +--------+         +------+
     |  C  |           | Pascal |         |  C++ |
     +-----+           +--------+         +------+
        |                  |
        |                  |
 +-------------+   +---------------+
 | Objective-C |   | Object Pascal |
 +-------------+   +---------------+
                           |
                           |
                      +--------+
                      | Delphi |
                      +--------+
** I'm not saying I'm right, but I think that C + + should be considered as a separate language, Objective-C as the successor С.

I would like to use Objective-C but it is very ugly syntax. :\
 
valsorym said:
understand that, Objective-C it is real heir C, but that object oriented language. C++ - object oriented language too, but it is a separate language, let's say: like C but not heir C.

Code:
     +-----+          
     |  C  |     ---- -->  +------+
     +-----+               | C++ |
        |                  +------+
        |                    |
 +-------------+       +-------------+
 | Objective-C |  --> | Objective-C++ | 
 +-------------+       +-------------+

I am not really sure but both are heir of C, because both are supersets of C, for example exist Objective-C++ than is a
combination of C++ and Objective-C syntax. Objective-C++ adds to C++ the extensions that Objective-C adds to C.
 
drhowarddrfine said:
You're not offending me. I'm just pointing out things I read.

That is good. Since I tend to question anything that is not nailed down in all directions and dimensions some people get annoyed at me for constantly poking holes into arguments and plans. For me, this is what I consider part of my job.
 
valsorym said:
I would like to use Objective-C but it is very ugly syntax. :\
NuLL3rr0r said:
Agreed!! The ugliest syntax that I've ever seen.
Ambiguous feelings.
Lack of familiarity with new language syntax and philosophy behind the structure of language is major cause of feeling like that.

This thread has been started a fortnight ago. For those who are familiar with one language beforehand, It's more than just enough time to learn the syntax of new language.
 
zhoopin said:
Ambiguous feelings.
Lack of familiarity with new language syntax and philosophy behind the structure of language is major cause of feeling like that.

This thread has been started a fortnight ago. For those who are familiar with one language beforehand, It's more than just enough time to learn the syntax of new language.

No I programmed in plenty of languages in past 15 years including (if we count scripting too):
C++, C#, Perl, Ruby, Python, Lua, JavaScript/JScript,
ActionScript, UnrealScript, VB.NET, VB6,
Delphi/Pascal, VBScript, FoxPro, Logo, GW/QBasic
and CMake even Assembly (Of course there are languages
like C, Java, PHP which I had no experiments with).

It is ugly by any means!!
 
NuLL3rr0r said:
It is ugly by any means!!

That is something I also found highly disturbing in objective-c. Being a compiler geek, I mostly value what the thing does behind the back, but the syntax from objective-c has the double inheritance of C and smalltalk. The "object" part is taken from a language with a very different syntax and thus feels pretty alien to the C part. The C part then looks alien in areas where a lot of object oriented code is crammed together. This is one point that was done a lot better in C++ (when leaving templates out), it fits a lot better into the "picture".

Core of the ugly is, IMHO, the way to pass parameters to methods which is completely different to C in syntax. Passing more than one parameter simply looks ugly to the C eye.

But what the language offers in power is, is several areas, a lot better and clearer as C++. I would like to do some work with it, just to get to know it better and maybe love or hate it with more gusto and reason ;)
 
From http://gcc.gnu.org/
GCC now uses C++ as its implementation language [2012-08-14]
The cxx-conversion branch has been merged into trunk. This switches GCC’s implementation language from C to C++. Additionally, some data structures have been re-implemented in C++ (more details in the merge announcement). This work was contributed by Lawrence Crowl and Diego Novillo of Google.

From http://gcc.gnu.org/wiki/cxx-conversion#Rationale
Migrating GCC to C++ as implementation language:
C++ is a standardized, well known, popular language.
C++ is nearly a superset of C90 used in GCC.
The C subset of C++ is just as efficient as C.
C++ supports cleaner code in several significant cases.
C++ makes it easier to write and enforce cleaner interfaces.
C++ never requires uglier code.
C++ is not a panacea but it is an improvement.
 
I like C for it's simplicity, but whenever I start a project in it I start to miss C++ features at some point. That's especially true when I try to keep C90 compatibility...

kpedersen said:
Saying that... C++/clr (Microsoft's C++ .NET) is actually pretty decent.. it is a shame mono doesn't have this because it seems that Microsoft is going to drop it once C# becomes better at handling native libraries.
The .NET library is the most rushed through and undersigned standard library that I've seen. Sometimes it feels like a collection of ad-hoc hacks and for this reason I just can't stand writing in .NET. Or rather - I couldn't because now I just steer clear of it.
SR_Ind said:
However, to be fair, .NET is an excellent framework.
I'm hugely surprised to read this and would like to know what makes you like it so much.
 
Slurp said:
I couldn't because now I just steer clear of it.

Agreed, but unfortunately these days .NET is so well marketed that it is extremely prevalent in most software companies. My previous statement was mostly that I simply prefer writing in C++/clr than C#. However, native C/C++ and the best library for the job is really the *only* solution.

I think it is great that Microsoft is cooling off .NET and moving towards native C++ or Javascript, it is going to leave the "consumer-developers" standing around looking confused just like in the Visual Basic 6 days :D

(But will they finally choose C++? Nooo, 'course not! The fools will probably choose some proprietary MS Javascript clone instead. WinRT? Then the whole cycle begins again...)
 
Well the C vs C++ endless debate.
Operating Systems are usually written in C for different reasons, mainly because to program OSs you have to deal with low level details, and low level details are not easily modeled thru objects (which are higher abstractions). Think about the mi_switch() function: that is a function that switches two threads, it is not something like "the only instance of the scheduler object have to switch two object threads". This of course does not mean that OSs do not include objects: a process is an object, and structs represent them very well. After all, an object is a struct with the data and somewhere methods contained in a table.
Another reason is about compilers: while it is simple todays to find a good C++ compiler, it was not in the past. This is why Gnome does not use C++ but C.
Last but not least there is to deal with the develooers: while a lot know quite well C, a few know C++ and in particular a very few know how to use it effectively.
Having said that, OSs can be developed using C++, as well as using Java and other languages. HaikuOS is one of such system (as far as I remember).
 
For me nature of the code I am writing will determine if I will use C or C++. You have to plan ahead to save time, things like code reusability, portability and processing features determine for me what language I will use.

For example if I write really general code that I want to reuse in ruby/python later on I will definitely write it in C for painless porting as a native module. Another thing to keep in mind is if you will heavily use dynamic data types and hashing, because of lack of templates in C it gets very ugly and you have to drag a bunch of libraries with you, while stdc++ lib will cover most of it.
 
valsorym said:
I would like to use Objective-C but it is very ugly syntax. :\

Its not about how pretty it is. Its more about having a clear separation of the layers in the syntax. Its easer to read through the code and see how Objective layer wraps the C/C++ code. At start it feels weird/wrong, but like with everything you need to get used to it.
 
expl said:
Its easer to read through the code and see how Objective layer wraps the C/C++ code. At start it feels weird/wrong, but like with everything you need to get used to it.

Agree.

Moreover, Objective C could be considered a Java father, therefore it should not scare so much.
 
Slurp said:
The .NET library is the most rushed through and undersigned standard library that I've seen. Sometimes it feels like a collection of ad-hoc hacks and for this reason I just can't stand writing in .NET. Or rather - I couldn't because now I just steer clear of it.

I'm hugely surprised to read this and would like to know what makes you like it so much.
Although this is off topic (unless someone moves this to a Mono/C# thread), let me answer.

I didn't get you, what is "undersigned" standard library?

To be direct to the point, .NET is one of the well designed libraries. I worked on the first project way back in 2001/2002 with the beta release. In those days there was nothing on the Internet. There was no complete documentation for the beta product. We did the project with whatever content there was in MSDN and .... intellisense of Visual Studio. In my opinion this is only possible when the library you are working with is a well structured, intuitive, with a sensible nomenclature.

To anybody coming from direct C background the library would seem weird. Similar complain was from Visual Basic programmers. It is due to lack of familiarity and experience with large scale object oriented development.

Talking of ad-hoc hacks, to my experience two libraries take the honour, GTK and Java.

How queer my choice of tools are C# and Qt...the opposites of the above two. :)
 
Back
Top