NO

Author Topic: What are the advantages of any of the OOP languages over C?  (Read 9431 times)

defrancis7

  • Guest
What are the advantages of any of the OOP languages over C?
« on: September 21, 2012, 05:31:46 PM »
Perhaps I should ask this in a different thread:  what are the advantages of C++, C#, or any of the other OOP languages over C?  What can they do that C can't?  I am just being curious.

CommonTater

  • Guest
Re: What are the advantages of any of the OOP languages over C?
« Reply #1 on: September 21, 2012, 06:35:42 PM »
Perhaps I should ask this in a different thread:  what are the advantages of C++, C#, or any of the other OOP languages over C?  What can they do that C can't?  I am just being curious.

They are different languages, comparisons aren't entirely fair. 

There's nothing C++ can do that C can't... including OOP.  It's just that in C doing OOP requires some work that is done behind the scenes for you in C++ ...

I know nothing about C# and don't really care to. :D




Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: What are the advantages of any of the OOP languages over C?
« Reply #2 on: September 21, 2012, 06:57:54 PM »
Next question is what C can do, what those OOPs can't do ???
OOPs, what i said  ;)
May the source be with you

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: What are the advantages of any of the OOP languages over C?
« Reply #3 on: September 21, 2012, 08:47:15 PM »
C is known to seldom rely on any runtime libraries.

C++ compiled with VC nearly always requires the correct VC runtime libraries to be installed.

C# relies on the .NET framework, which is available in 7 versions (1.0, 1.1, 2.0, 3.0, 3.5, 4.0, 4.5) already.

I haven't come across an operating system coded in any of the other languages due to the dependencies of the other languages.
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

  • Guest
Re: What are the advantages of any of the OOP languages over C?
« Reply #4 on: September 21, 2012, 09:12:33 PM »
C is known to seldom rely on any runtime libraries.

C++ compiled with VC nearly always requires the correct VC runtime libraries to be installed.

In fairness, VC++ can run without the msvcrt if you compile and link it with the right flags (-mt) ... which nobody ever does.

Quote
I haven't come across an operating system coded in any of the other languages due to the dependencies of the other languages.

The earliest versions of windows and parts of MS-DOS were in Pascal... but that's a dead horse now.


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: What are the advantages of any of the OOP languages over C?
« Reply #5 on: September 21, 2012, 09:29:25 PM »
Quote
In fairness, VC++ can run without the msvcrt if you compile and link it with the right flags (-mt) ... which nobody ever does.
what you mean about that ???
You need some sort of runtime library ???
In msvc/PellesC C you can run program without crt  :)
May the source be with you

CommonTater

  • Guest
Re: What are the advantages of any of the OOP languages over C?
« Reply #6 on: September 21, 2012, 09:41:59 PM »
Quote
In fairness, VC++ can run without the msvcrt if you compile and link it with the right flags (-mt) ... which nobody ever does.
what you mean about that ???
You need some sort of runtime library ???
In msvc/PellesC C you can run program without crt  :)


In VC++ you can link the MSVCRT into the runtime giving you a free-standing executable ... just like in Pelles C.


http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=vs.100).aspx  ... check the /MT option.

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: What are the advantages of any of the OOP languages over C?
« Reply #7 on: September 21, 2012, 10:32:42 PM »
C++ compiled with VC nearly always requires the correct VC runtime libraries to be installed.
In fairness, VC++ can run without the msvcrt if you compile and link it with the right flags (-mt) ... which nobody ever does.

This is why I said nearly ;)
To be honest Windows is shipping with a small set of the VC++ runtime libraries, similar to the .NET Framework.

The earliest versions of windows and parts of MS-DOS were in Pascal... but that's a dead horse now.

Sure there are more languages that are used to build operating systems, but C++ and C# are not one of those.
I was limiting the answer to the languages discussed here.
« Last Edit: September 21, 2012, 10:34:24 PM by Stefan Pendl »
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

  • Guest
Re: What are the advantages of any of the OOP languages over C?
« Reply #8 on: September 22, 2012, 12:29:07 AM »
Sure there are more languages that are used to build operating systems, but C++ and C# are not one of those.
I was limiting the answer to the languages discussed here.

You probably could write an OS in C++ ... but why would you want to?
C# is managed code, intended only for end user applications.

Well, in fairness to the OP the original question was about what advantages OOP languages might have over C ... 

My simple answer to that is "None". 

They are different languages, with a different focus. C++ (for example) is bent on end user apps and re-useable code... C is more nuts and bolts, it's "closer to the metal" and far better suited to a message driven environment like WinAPI code. I've tried writing C++ apps using Windows API and it always ends up looking like C code...

Other OOP languages like Delphi and Oberon were major disasters resulting in massive program bloat to handle all the class stuff... like 1mb+ to play a midi file... something C can do with a couple of lines in under 10k.

So we're back to what Ralf said the other day ... Use the right tool for the job.  If you're writing Windows API code, C is probably your best choice.  If you're writing in a team with lots of ready to go classes, C++ makes the most sense... and so on.



 

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: What are the advantages of any of the OOP languages over C?
« Reply #9 on: September 22, 2012, 08:04:35 AM »
Ralf is totally right about the right tool <-> right job relation.

I started to program in C to build plug-ins for a major CAD system we use at work.
I am now using VB.NET, since the API support has changed to .NET for this system.

Sure I could have started with C#, but I have a long history of BASIC, so VB.NET looked more familiar to me.

If I need some quick proof of concept, I go back to a traditional BASIC dialect, since that is what I started with.
---
Stefan

Proud member of the UltraDefrag Development Team

Offline Vortex

  • Member
  • *
  • Posts: 797
    • http://www.vortex.masmcode.com
Re: What are the advantages of any of the OOP languages over C?
« Reply #10 on: September 22, 2012, 10:44:37 AM »
There is also the SolAsm project, an assembler coded with 100% assembly :

http://oby.ro/sol_asm/index.html

A C project can be built without any C run-time libraries. You can even code your own run-time lib.
Code it... That's all...

defrancis7

  • Guest
Re: What are the advantages of any of the OOP languages over C?
« Reply #11 on: September 22, 2012, 04:27:23 PM »
Thanks guys!  I was just curious as to what the OOPs could do that C couldn't.  It would seem that C can do anything that C++, C#, or any other OOP can; it just may require some extra work on the part of the programmer.

Thanks again,  Dee.

CommonTater

  • Guest
Re: What are the advantages of any of the OOP languages over C?
« Reply #12 on: September 22, 2012, 05:22:29 PM »
It would seem that C can do anything that C++, C#, or any other OOP can; it just may require some extra work on the part of the programmer.

Actually if you want to get right down to it ... C can do stuff OOP languages cannot.
 
One example is device drivers which are almost 100% C code.
 
FWIW... Windows, Linux, BSD, and OSx were written in C for good reasons.
 
But don't get me wrong OOP has it's place, as I mentioned.  It really is about "the right tool for the job"
 

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: What are the advantages of any of the OOP languages over C?
« Reply #13 on: September 22, 2012, 05:33:02 PM »
In addition it is hard to use plain Windows API functions in .NET for instance.

In some cases it is even impossible to use API functions due to the used data types for the arguments, which don't have an equivalent in .NET.
---
Stefan

Proud member of the UltraDefrag Development Team

Online AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: What are the advantages of any of the OOP languages over C?
« Reply #14 on: September 25, 2012, 10:59:31 AM »
Thanks guys!  I was just curious as to what the OOPs could do that C couldn't.  It would seem that C can do anything that C++, C#, or any other OOP can; it just may require some extra work on the part of the programmer.
The first C++ compiler translated C++ to C, this shows that C can do everthing, what C++ can. ;)
But I would say, with OOP you create simpler very complex constructes, but you have no idea what the compiler does with them.

PS: AFAIK Apple uses Objective-C for system programming for iOS and Mac. ;)
best regards
 Alex ;)