28ed6 C vs C++ - your opinion. - Page 3 - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Development > Userland Programming & Scripting

Userland Programming & Scripting C, Shell, Perl, Sed & Awk

Reply
 
Thread Tools Display Modes
  #51  
Old August 19th, 2012, 17:11
drhowarddrfine drhowarddrfine is offline
Member
 
Join Date: Nov 2008
Location: St. Louis, Missouri
Posts: 636
Thanks: 30
Thanked 123 Times in 71 Posts
Default

Quote:
Originally Posted by kpedersen View Post
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.
Quote:
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.
Reply With Quote
The Following User Says Thank You to drhowarddrfine For This Useful Post:
valsorym (August 22nd, 2012)
  #52  
Old August 19th, 2012, 21:28
SR_Ind SR_Ind is offline
Member
 
Join Date: Feb 2009
Location: India, Kolkata
Posts: 114
Thanks: 3
Thanked 13 Times in 12 Posts
Default

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.
Reply With Quote
The Following User Says Thank You to SR_Ind For This Useful Post:
valsorym (August 22nd, 2012)
  #53  
Old August 20th, 2012, 10:26
Crivens Crivens is offline
Member
 
Join Date: Oct 2010
Posts: 549
Thanks: 72
Thanked 111 Times in 78 Posts
Default

Quote:
Originally Posted by drhowarddrfine View Post
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.
__________________
Optimists believe we live in the best world possible. Pessimists agree to this.

Two little lights, blinking out in a sky full of stars - we will never forget you. I miss you so much
Reply With Quote
The Following 2 Users Say Thank You to Crivens For This Useful Post:
NuLL3rr0r (August 23rd, 2012), valsorym (August 22nd, 2012)
  #54  
Old August 20th, 2012, 20:04
drhowarddrfine drhowarddrfine is offline
Member
 
Join Date: Nov 2008
Location: St. Louis, Missouri
Posts: 636
Thanks: 30
Thanked 123 Times in 71 Posts
Default

Quote:
Originally Posted by Crivens View Post
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.
In his rant, he says they tried using C++ before.
Reply With Quote
The Following User Says Thank You to drhowarddrfine For This Useful Post:
valsorym (August 22nd, 2012)
  #55  
Old August 21st, 2012, 01:04
nslay's Avatar
nslay nslay is offline
Junior Member
 
Join Date: Nov 2008
Location: Tallahassee, FL
Posts: 67
Thanks: 0
Thanked 8 Times in 7 Posts
Default

Quote:
Originally Posted by drhowarddrfine View Post
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).
Reply With Quote
The Following 2 Users Say Thank You to nslay For This Useful Post:
NuLL3rr0r (August 23rd, 2012), valsorym (August 22nd, 2012)
  #56  
Old August 21st, 2012, 09:24
Crivens Crivens is offline
Member
 
Join Date: Oct 2010
Posts: 549
Thanks: 72
Thanked 111 Times in 78 Posts
Default

Quote:
Originally Posted by drhowarddrfine View Post
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.
__________________
Optimists believe we live in the best world possible. Pessimists agree to this.

Two little lights, blinking out in a sky full of stars - we will never forget you. I miss you so much
Reply With Quote
The Following 2 Users Say Thank You to Crivens For This Useful Post:
NuLL3rr0r (August 23rd, 2012), valsorym (August 22nd, 2012)
  #57  
Old August 21st, 2012, 12:24
drhowarddrfine drhowarddrfine is offline
Member
 
Join Date: Nov 2008
Location: St. Louis, Missouri
Posts: 636
Thanks: 30
Thanked 123 Times in 71 Posts
Default

You're not offending me. I'm just pointing out things I read.
Reply With Quote
  #58  
Old August 21st, 2012, 21:56
valsorym's Avatar
valsorym valsorym is offline
Member
 
Join Date: Jun 2011
Location: Ukraine
Posts: 419
Thanks: 357
Thanked 20 Times in 17 Posts
Default

Quote:
Originally Posted by UNIXgod View Post
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.
Reply With Quote
  #59  
Old August 22nd, 2012, 02:09
yoxter's Avatar
yoxter yoxter is offline
Junior Member
 
Join Date: Jan 2012
Posts: 24
Thanks: 12
Thanked 4 Times in 4 Posts
Default

Quote:
Originally Posted by valsorym View Post
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.
Reply With Quote
The Following User Says Thank You to yoxter For This Useful Post:
valsorym (August 22nd, 2012)
  #60  
Old August 22nd, 2012, 09:03
Crivens Crivens is offline
Member
 
Join Date: Oct 2010
Posts: 549
Thanks: 72
Thanked 111 Times in 78 Posts
Default

Quote:
Originally Posted by drhowarddrfine View Post
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.
__________________
Optimists believe we live in the best world possible. Pessimists agree to this.

Two little lights, blinking out in a sky full of stars - we will never forget you. I miss you so much
Reply With Quote
  #61  
Old August 23rd, 2012, 15:53
NuLL3rr0r's Avatar
NuLL3rr0r NuLL3rr0r is offline
Junior Member
 
Join Date: Jan 2010
Posts: 72
Thanks: 54
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by valsorym View Post
I would like to use Objective-C but it is very ugly syntax.
Agreed!! The ugliest syntax that I've ever seen.
Reply With Quote
  #62  
Old August 23rd, 2012, 18:00
zhoopin zhoopin is offline
Junior Member
 
Join Date: Nov 2011
Posts: 60
Thanks: 5
Thanked 14 Times in 14 Posts
Default

Quote:
Originally Posted by valsorym View Post
I would like to use Objective-C but it is very ugly syntax.
Quote:
Originally Posted by NuLL3rr0r View Post
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 (ʒuːpiːn) - Meri - Mehrshad Moslehi
Reply With Quote
The Following User Says Thank You to zhoopin For This Useful Post:
NuLL3rr0r (August 23rd, 2012)
  #63  
Old August 23rd, 2012, 23:09
NuLL3rr0r's Avatar
NuLL3rr0r NuLL3rr0r is offline
Junior Member
 
Join Date: Jan 2010
Posts: 72
Thanks: 54
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by zhoopin View Post
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!!

Last edited by NuLL3rr0r; August 25th, 2012 at 01:10.
Reply With Quote
  #64  
Old August 24th, 2012, 08:23
Crivens Crivens is offline
Member
 
Join Date: Oct 2010
Posts: 549
Thanks: 72
Thanked 111 Times in 78 Posts
Default

Quote:
Originally Posted by NuLL3rr0r View Post
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
__________________
Optimists believe we live in the best world possible. Pessimists agree to this.

Two little lights, blinking out in a sky full of stars - we will never forget you. I miss you so much
Reply With Quote
The Following User Says Thank You to Crivens For This Useful Post:
NuLL3rr0r (August 25th, 2012)
  #65  
Old August 25th, 2012, 01:11
NuLL3rr0r's Avatar
NuLL3rr0r NuLL3rr0r is offline
Junior Member
 
Join Date: Jan 2010
Posts: 72
Thanks: 54
Thanked 1 Time in 1 Post
Default

@Crivens

My English sucks a little bit
Thank you for correcting me.
Reply With Quote
  #66  
Old August 25th, 2012, 03:50
NuLL3rr0r's Avatar
NuLL3rr0r NuLL3rr0r is offline
Junior Member
 
Join Date: Jan 2010
Posts: 72
Thanks: 54
Thanked 1 Time in 1 Post
Default

From http://gcc.gnu.org/
Quote:
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
Quote:
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.
Reply With Quote
  #67  
Old August 25th, 2012, 15:51
SR_Ind SR_Ind is offline
Member
 
Join Date: Feb 2009
Location: India, Kolkata
Posts: 114
Thanks: 3
Thanked 13 Times in 12 Posts
Default

GCC in C++? Linus will have a fit
Reply With Quote
  #68  
Old August 26th, 2012, 18:27
Slurp Slurp is offline
Junior Member
 
Join Date: Aug 2011
Posts: 67
Thanks: 6
Thanked 2 Times in 2 Posts
Default

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...

Quote:
Originally Posted by kpedersen View Post
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.
Quote:
Originally Posted by SR_Ind View Post
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.
Reply With Quote
  #69  
Old August 27th, 2012, 00:21
kpedersen kpedersen is offline
Member
 
Join Date: Apr 2009
Posts: 674
Thanks: 9
Thanked 100 Times in 72 Posts
Default

Quote:
Originally Posted by Slurp View Post
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

(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...)
Reply With Quote
  #70  
Old August 27th, 2012, 10:17
fluca1978 fluca1978 is offline
Member
 
Join Date: May 2010
Posts: 663
Thanks: 27
Thanked 60 Times in 57 Posts
Default

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).
Reply With Quote
  #71  
Old August 27th, 2012, 11:39
expl's Avatar
expl expl is offline
Member
 
Join Date: Oct 2009
Location: In your shell, stealing your cookies.
Posts: 639
Thanks: 0
Thanked 113 Times in 104 Posts
Default

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.
Reply With Quote
  #72  
Old August 27th, 2012, 11:50
expl's Avatar
expl expl is offline
Member
 
Join Date: Oct 2009
Location: In your shell, stealing your cookies.
Posts: 639
Thanks: 0
Thanked 113 Times in 104 Posts
Default

Quote:
Originally Posted by valsorym View Post
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.
Reply With Quote
  #73  
Old August 27th, 2012, 14:01
fluca1978 fluca1978 is offline
Member
 
Join Date: May 2010
Posts: 663
Thanks: 27
Thanked 60 Times in 57 Posts
Default

Quote:
Originally Posted by expl View Post
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.
Reply With Quote
  #74  
Old September 1st, 2012, 19:09
SR_Ind SR_Ind is offline
Member
 
Join Date: Feb 2009
Location: India, Kolkata
Posts: 114
Thanks: 3
Thanked 13 Times in 12 Posts
Default

Quote:
Originally Posted by Slurp View Post
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.
Reply With Quote
  #75  
Old September 2nd, 2012, 02:40
tommyjung tommyjung is offline
Junior Member
 
Join Date: Aug 2012
Location: USA
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

https://michaelochurch.wordpress.com...ges-to-master/

Reading this article will help choosing languages to learn. c++ does well on what it's good at in a very complicated way.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] Your opinion before I try installing? brigzzy X.Org 8 March 2nd, 2012 02:26
Processor opinion: Athlon II or Phenom II roddierod Off-Topic 23 March 15th, 2011 07:50
Your opinion about performing upgrading on laptops sysman Mobile Computing 7 June 10th, 2010 11:28
trailer of my new sk8 movie :) (It would be my pleasure to tell me your opinion) sk8harddiefast Off-Topic 2 May 27th, 2010 01:41
opinion needed: 2 LANs (wireless + wired) or just 1? rambetter Networking 13 September 9th, 2009 04:17


All times are GMT +1. The time now is 06:02.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0