Coffeehouse Thread

46 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Why all the C/C++ interest all of a sudden?

Back to Forum: Coffeehouse
  • User profile image
    rt15


    4 hours ago, evildictait​or wrote
    Skype: Written in C++

    Sorry, but I cannot let you say that. Wink Skype is written in Delphi, as well as many more or less famous applications like Total Commander, TOAD, Dev-C++, Inno Setup... And obviously, Delphi is written in Delphi.

    But I do agree with you. After ten years of .NET, most of known windows desktop applications remain written with, let's say, "native low level languages".

  • User profile image
    cbae

    I'm not sure, but Expression Blend looks like it's a WPF application. VS2010 looks like it could be as well.

  • User profile image
    AndyC

    ,cbae wrote

    I'm not sure, but Expression Blend looks like it's a WPF application. VS2010 looks like it could be as well.

    Expression Blend is a WPF app, written in C# in my memory of the C9 vids on it are correct. VS2010 uses WPF, quite possibly from C++/CLI although it could just as easily be C# or VB I suppose.

    And, in fairness, many (not all) of those are written in C/C++ for legacy reasons rather than any inherent benefit from the language for the type of product they are.

  • User profile image
    rt15
  • User profile image
    Sven Groot

    @rt15: It's quite a bit faster than VS2008, which didn't use WPF.

  • User profile image
    Royal​Schrubber

    Existing applications, big applications and cross-platform applications are written in C++, it will be much easier to add new UI in the next version than to keep two separate code bases each in a different language. That's why. 

  • User profile image
    Bass

    Yes and quite frankly the new version of C++ really starts to narrow the gap even as far as pure high-level RAD development goes (C#'s turf). Implicit types, closures, for each loop, and some goodies that IMO are very well designed like the STL for collections and smart pointers. What it lacks is a huge class library, but with Qt and Microsoft's APIs if you do Microsoft you have a lot of functionality and options there as well.

  • User profile image
    Sven Groot

    @Bass: I like C++11 a lot, but there's one huge advantage that Java and C# and other managed languages still have: reflection.

    Oh, and another: compilation speed. Dear god compiling C++ is slow, especially if you include some substantial headers with lots of templates, like most of the Boost headers.

  • User profile image
    Bass

    So you can load libraries dynamically (it's not a STL thing, it's in POSIX and Win32 APIs) and introspect their symbols pretty easily. It's not true reflection I guess but you can implement some complex plugin systems and what not using this ability. Other than that the big selling point of reflection at least in Java is annotations (called "attributes" in C#). Don't know if C++ has something similar, not a huge C++ expert.

  • User profile image
    Sven Groot

    @Bass: You can sort of fake attributes in C++ with template specializations, e.g. a hypothetical C++ equivalent of SerializableAttribute would be something like this:

    template<typename T>
    struct is_serializable
    {
        static const bool value = false;
    };
    
    // Indicate Foo is serializable
    template<>
    struct is_serializable<Foo>
    {
        static const bool value = true;
    };

    For this particular situation I'd probably use some of the C++ library to turn it into a one liner:

    template<typename T> struct is_serializable : public std::false_type { };
    
    template<> struct is_serializable<Foo> : public std::true_type { };

    Which then allows you to do something like:

    if( is_serializable<SomeType>::value )
        // Do serialization
    else
        throw std::runtime_error("Not serializable");

    Of course, actually doing the serialization requires you to write code for each serializable type due to the lack of reflection. Wink

  • User profile image
    BitFlipper

    Why would MS push C++ over .Net languages if C++ applications aren't portable between x86/x64/ARM (without requiring a recompile)? If anything they should be pushing .Net for this reason alone.

    I think what is happening is that they created WinRT with the intention of making all languages equal (all use WinRT on an equal footing). This finally allows C++ applications to get away from Win32, hence the sudden interest from people that are still sticking with C++ for whatever reason.

    I'm working on a project now that is roughly 50/50 split between C++ and C#, and I can honestly say that working with C++ is a pain. C# is much cleaner and easier to code in (for one, no header files, which requires you to essentially do the same thing twice in C++ - seriously, we should not need to do this...).

  • User profile image
    MSGale

    Let me ask the question differently,  "Why do we need C#  or VB?"  What can they do that C++ can't?  Lastly I have a shocking piece of news, not all computers  support VB or C# and all applications  use a GUI.  

  • User profile image
    DeathBy​VisualStudio

    @MSGale: Well to use my understanding of one of Microsoft's justification for including HTML/JS in WinRT as an answer: more reach; it includes more programmers than limiting it to C++.

    Like I'm sure the HTML/JS developers would claim against why use C#/XAML they would say because it's easier, less to deal with. The same could be said for C#/XAML over C++/HTML/XAML/WIN32s.

    And you're right, it is a shame that all computers don't support C#. Microsoft was on a track that might have lead us there but they pulled the plug on Silverlight.

  • User profile image
    TexasToast

    I use both but like all developers I know and work with I prefer C#.   I use both because C# does not replace C/C++ in alot of applications. (not supported)  C# is more advanced and makes development much easier and cleaner.   Even though silverlight disappears (i agree its a shame)  and least C# lives on with WinRT .   

    If you ask the question of what can C# do that C++ cannot do you are asking the wrong question.   Its not about what it can do,  its about how it does it to make your life much easier.     I like to write software that flows naturally to solve my problems.   C/C++ could have been improved to be modern like C# but it is too entrenched in the world where you just cannot make any changes.  It is what it is and will stay stuck there forever.  Too many different opinions on big committees do not allow it to change.     C#/ Java started with clean slates and could greatly improve on what C/C++ did already.  

  • User profile image
    Ion Todirel

    @TexasToast: I don't know where this "clean" myth comes from, and C++ code being horrible. It can be OO can it not? You can make neat abstractions as deep as you want, can you not? Heck you can even have multiple inheritance in more than a way. Give it a chance and use it some more, when you're thinking horrible. It really depends what you're doing. It's OK to use C# and C++ in the same project, it really is, you don't have to use one language for everything Smiley That's rather limited.

    I would advise to check the new standard, just to see the kind of changes C++'s got. I wouldn't call that stagnation.

    I tend to prefer C++ nowadays, but that doesn't mean I wouldn't enjoy building some rich UI with WPF using C#. Sometimes I do wish C# had multiple inheritance or templates to aid solving the particular problem I'm working on in a nicer clever way. Sometimes I wish C++ had reflection. That's fine, nothing wrong in combining tools, that's what they were made for.

     

  • User profile image
    AndyC

    @Ion Todirel: C++ has a lot of baggage that comes along from it's history as a pre-compilation pass over C that makes the language quirky in places. Learning and understanding C++ code requires you to delve into things like the preprocessor (even if good C++ should avoid it), the oddities of things like overloading the ++ operator and also deal with some of the poorer decisions of C like failing to be strict about the size of things like Ints. And then you have things like friend functions which have always seemed syntactically awkward at best.

    In contrast C# generally contains much less legacy baggage and that means you get to focus far more on solving your problem rather than dealing with bits and pieces of housekeeping. I'm sure the new C++ standard has improved the language greatly but I'm not sure there is much that can really 'fix' some of the quirks without essentially producing an entirely new (if similar) language. If C# had compiled to native code rather than a runtime, I'm sure more people might have migrated app devlopment in that direction rather than ploughing on with C++.

  • User profile image
    TexasToast

    AndyC:  You are completely correct in your statement and I totally agree.  I dont think Ion has been programming that long and does not quite understand the difference.   I had always hoped that C# would have had a version that would have compiled to native.  Add back memory management and you basically kill of C++.    I have seen some of the new stuff coming out in C++ and the syntax just gets uglier.    Right now I am just stuck with C/C++ in some projects because of the platform, but I am always thankful when I can get back to C# since I can work twice as fast with fewer mistakes.

  • User profile image
    Ion Todirel

    @AndyC:That's true, sometimes it might be down to choices, sometimes there might not be a choice. But I like to think, generally, it's down to options. Still it wouldn't be fair to call all the code horrible, and it doesn't make it less cleaner, generally speaking.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.