Closed Thread
Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 64

Thread: C necessary before C++?

  1. #31
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: C necessary before C++?

    You forgot embedded systems. And why should not speed matter in desktop apps? In my opinion C++ is a great language when efficiency/power is a concern, but you want the benefits of OOP, templates and what not C can not offer. I am not saying that it's perfect. Writing applications in C++ is a thorough process, and the code is messy. As you also pointed out, compiling isn't exactly the light of speed. Though you don't usually choose C++ when coding time is important.

    Posted via CodeCall Mobile

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #32
    CCC
    CCC is offline Newbie
    Join Date
    Jun 2009
    Posts
    15
    Rep Power
    0

    Re: C necessary before C++?

    For embedded systems still C is used much more often than C++. Programming embedded systems in C++ is often cumbersome as many features of C++ are not well supported by the compilers or hardware e.g. exceptions or templates. If you ever programmed for Symbian you know what I mean.

    For Desktop of course speed matters - but not every single 1%. Java or C# on desktop is fast enough - see JEdit for example. Probably the best programming text editor in the world and runs like the wind on a 3-year old computer. Losing a few % in final performance* is usually worth spending 3 times less effort on coding or adding 3x more features.

    *) Actually there is only a slight slowdown on startup when compared to native apps. But - hardware still gets better - and it doesn't matter as much now as 10 years ago.

  4. #33
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: C necessary before C++?

    It is true that C and ASM still rules embedded systems, but C++ is making its way in, for obvious reasons.

    There are many desktop apps where speed is important, take Anti-Virus systems and 3D studios for instance. Many desktop apps also work with hardware/low level stuff. C++ is then a natural choice, as it provides the power of a low-level language, while providing the tools for writing well designed code that C lacks.

    Posted via CodeCall Mobile

  5. #34
    CCC
    CCC is offline Newbie
    Join Date
    Jun 2009
    Posts
    15
    Rep Power
    0

    Re: C necessary before C++?

    But the same is true for many modern better designed languages.
    You can use asm, C or C++ from Python, Java, C# to write low-level stuff, and for the rest you have a real high-level, powerful language. C++ is not as expressive as Python or Java (note the additional lines of code you have to write for header files, copying constructors, memory management etc.)

    C++ lacks some important features nowadays considered as high-level - e.g. efficient garbage collection, reflection, AOP, modularity, closures etc.

  6. #35
    outsid3r's Avatar
    outsid3r is offline Programming God
    Join Date
    Jul 2008
    Posts
    621
    Rep Power
    19

    Re: C necessary before C++?

    Quote Originally Posted by marwex89 View Post
    It is true that C and ASM still rules embedded systems, but C++ is making its way in, for obvious reasons.

    There are many desktop apps where speed is important, take Anti-Virus systems and 3D studios for instance. Many desktop apps also work with hardware/low level stuff. C++ is then a natural choice, as it provides the power of a low-level language, while providing the tools for writing well designed code that C lacks.

    Posted via CodeCall Mobile
    I don't like much to say "C don't provide..." because C is a procedural language, and for that type of paradigm, is the best in my opinion, like C++ is the best OOP language in my opinion.

  7. #36
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: C necessary before C++?

    The additional lines you write in C++ mean more control to programmers. After having struggled to "hack" the higher level languages to do stuff they really weren't designed to, I value that control/power pretty high.

    This control of course means more work, and less "expressiveness". Yet, who really cares how "expressive" the code is if it is well documented (and works)?

    Posted via CodeCall Mobile

  8. #37
    outsid3r's Avatar
    outsid3r is offline Programming God
    Join Date
    Jul 2008
    Posts
    621
    Rep Power
    19

    Re: C necessary before C++?

    i fully agree with marwex, and it's logic! in ASSEMBLY we write much more lines than in any other language, but we have FULL control of everything...

  9. #38
    CCC
    CCC is offline Newbie
    Join Date
    Jun 2009
    Posts
    15
    Rep Power
    0

    Re: C necessary before C++?

    No. In C++ you don't have control about everything. Actually you have very little control on what is going on under the hood, unless you fall back to assembly or C and start writing ring 0 code. The control is just an illusion. E.g. you can't:
    1. talk directly to hardware (OS prohibits you from doing that)
    2. manage memory (OS does that for you, and you don't have access to raw memory addresses - C/C++ pointers are just handles)
    3. decide exactly, what optimizations the compiler does for you
    4. restrict access to some parts of API as in C#/Java
    5. protect yourself from undefined-behaviour

    In practice, you have more control in managed environment (as Java):
    1. you can do anything what OS provides
    2. GC does memory management for you - just a different memory allocation model (usually better for most applications).
    3. you have same level of control on HotSpot as on your C++ compilers
    4. you can control very precisely, what is allowed and what is not
    5. there is no undefined-behaviour problem here

    So, 1-3 - tie, 4-5: managed environment wins.
    Unless you are going to write ring 0 code, or part of an OS, there is NO POINT in starting new projects in C++. There are better designed OOP languages out there. Get D, C#, Java, Python or whatever. And for low level stuff, C is fine.

  10. #39
    outsid3r's Avatar
    outsid3r is offline Programming God
    Join Date
    Jul 2008
    Posts
    621
    Rep Power
    19

    Re: C necessary before C++?

    Quote Originally Posted by CCC View Post
    No. In C++ you don't have control about everything. Actually you have very little control on what is going on under the hood, unless you fall back to assembly or C and start writing ring 0 code. The control is just an illusion. E.g. you can't:
    1. talk directly to hardware (OS prohibits you from doing that)
    2. manage memory (OS does that for you, and you don't have access to raw memory addresses)
    3. decide exactly, what optimizations the compiler does for you
    4. restrict access to some parts of API as in C#/Java
    5. protect yourself from undefined-behaviour

    In practice, you have more control in managed environment (as Java):
    1. you can do anything what OS provides
    2. GC does memory management for you - just a different memory allocation model (usually better for most applications).
    3. you have same level of control on HotSpot as on your C++ compilers
    4. you can control very precisely, what is allowed and what is not
    5. there is no undefined-behaviour problem here

    So, 1-3 - tie, 4-5: managed environment wins.
    Unless you are going to write ring 0 code, or part of an OS, there is NO POINT in starting new projects in C++. There are better designed OOP languages out there. Get D, C#, Java, Python or whatever. And for low level stuff, C is fine.

    C++:

    1. Are you kidding? we are talking about language capabilities, not OS restrictions. C++ sure does the job.
    2. The OS just allocates an unused block of memory somewhere and returns us the address of the first byte, JUST THAT! We decide when we destroy that block explicitly, man wake up, we are talking about languages not OS kernel operations...
    3. Of course not, non-sense again... if you want to decide exactly what the instructions should be done, then don't use any language besides assembly!...

    JAVA:

    1. lol?
    2. GC manages memory at cost of extra processing, performance, memory, etc... sure is better we take care of memory instead... (and that's more control obviously!)

    Your comparisons don't make much sense really...

  11. #40
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: C necessary before C++?

    Once again, you forget embedded systems.

    Having more control in the controlled environments of Java and C#? I couldn't help but laugh, sorry

    C is usually fine for low level stuff, but with C++ one brought OOP and other high-level features into this world. And the other way around, low level capabilities into the OOP world.

    Posted via CodeCall Mobile

Closed Thread
Page 4 of 7 FirstFirst ... 23456 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts