Microsoft C# a replacement for old C++ language

Discussion in 'C++' started by Master Programmer, Nov 21, 2006.

  1. I heard from a friend that C++ is mainly being replaced as language of
    choice for most C++ programmers around the world. I guess this makes
    sence as it means that when learning you dont have to **** around
    sencelessly with low level garbage like pointers. I was going to learn
    C++ but if times are changing I think I will just learn C#, it seems
    more modern. I also thought about Java but its WAY too slow. I think
    it should be easy to learn as I have heaps of experience making complex
    programs using all versions of Visual Basic.

    Any comparisons out there?

    Thanks
    The Grand Master
    Master Programmer, Nov 21, 2006
    #1
    1. Advertising

  2. Master Programmer

    VJ Guest

    Master Programmer wrote:
    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world. I guess this makes
    > sence as it means that when learning you dont have to **** around
    > sencelessly with low level garbage like pointers. I was going to learn
    > C++ but if times are changing I think I will just learn C#, it seems
    > more modern. I also thought about Java but its WAY too slow. I think
    > it should be easy to learn as I have heaps of experience making complex
    > programs using all versions of Visual Basic.
    >
    > Any comparisons out there?
    >


    You call pointers garbage, but it depends what you put in them.

    I am yet to see a microsoft product that does not crash. I crashed every
    their shit I touched. They probably hire bunch of monkeys to program
    their software

    It all depends what are your preferences, and what you want to do. If
    you hate pointers go for java, but I have to agree its slow. I didnt
    try c# and probably will not see it for a while, but I see some people
    are happy with it.
    Tried searching for "c++ vs c#" ?
    VJ, Nov 21, 2006
    #2
    1. Advertising

  3. Master Programmer

    DragonSt0rm Guest

    Master Programmer wrote:

    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world.


    That is mostly hype. Yes, for some tasks C# can be a good tool if you really
    don't need all the horsepower of C++.

    Unless java, C# has the using statement to provide some degree object
    lifecycle control, but it is still to primitive to rely on it for all
    resource management.

    When Java first appeared, the enthusiasm for GC was so high that all over
    the place we read: "The need for the programmer, to do bookeeping are gone,
    just allocate and forget, GC will take care". Many beginners did just that,
    and saw their software locking, hanging, crashing or having unexpected
    behaviors. Well, the memory is not the single critical resource one use
    inside an object. You often open a file, a named semaphore or pipe, a
    socket and so on. This are resources that you can not allow the GC to take
    care of them at his own will, when he feel so.

    So, the classical C++ paradigm:

    x=new X(); ..... do work here .....; delete x;

    has become in Java:

    x=new X(); ..... do work here .....; x->Dispose();

    The same amount of bookkeeping is required, and the task is a bit more
    tedious. Because in C++ you know that every new must eventually "be closed"
    by a delete. In java and C# you actually need to keep track of disposable
    or non disposable objects.

    And if you look and see that the intensive use of STL containers, smart
    pointers and a carefull design can help you not to care (too much) about
    deleting objects, the C++ seems like the paradigm winer here.

    I often use to say: whenever complain about lack of GC in C++ don't really
    understand programming to well. The creators of Java and C# being included
    in this category too.

    > I guess this makes
    > sence as it means that when learning you dont have to **** around
    > sencelessly with low level garbage like pointers.


    I often use to say: whenever complain about lack of GC in C++ don't really
    understand programming to well.

    > I was going to learn
    > C++ but if times are changing I think I will just learn C#, it seems
    > more modern.


    I would name it "overhyped" but that is the whole point. Marketing sells.

    > I also thought about Java but its WAY too slow.


    Is getting better all the times. Yes, it is a bit slow but definitely not
    the horror story it was 10 years ago.

    And also, now it is open source. This will guarantee that no company will
    mess up with java agenda. C# specs can be changes by MS at all any time.
    Also, they launch the new specs only when they are ready to get with a new
    version on the market.

    That creates an about 2 year gap betwen MS.NET and Mono project. Since most
    programmers like to try the newest tools to take advantage of the new
    stuff, this create a portability gap betwen the software running on Windows
    and on Mono.

    Most Windows programmers are also not very well educated about the
    portability issues (or don't care about them) so their code is littered
    with PInvoke and hardcoded path strings like "C:\\Windows\\...". This kind
    of idiotic code will not run on other OS despite the existence of a
    compatible .NET engine there. Java programmers on the other side are
    "evangelised" about portability from cradle and java library is more
    complete than .NET so you don't need to use (that often) OS specific calls.
    As a result, the average java code it is way way way more portable than C#
    code.

    Because we don't live into a closed world, and because the technology evolve
    rapidly, and because smart people don't like to be handcuffed by a
    particular vendor, I strongly recommend Java over C# if you don't like C++.

    > I think
    > it should be easy to learn as I have heaps of experience making complex
    > programs using all versions of Visual Basic.


    A VB guy actually complaining about Java speed ?

    > Any comparisons out there?


    Yes. C++ rules, Java suck but you should always prefer Java instead of C#.
    DragonSt0rm, Nov 21, 2006
    #3
  4. Master Programmer:

    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world. I guess this makes
    > sence as it means that when learning you dont have to f*** around
    > sencelessly with low level garbage like pointers.



    (We curse for a reason. If you blend them through your regular everyday
    speech, you reduce their efficacy when actually feel a need to use them.
    And it's unpleasant to the untrained ear.)

    It really depends how dumb a programmer you want to be. You program in the
    likes of Java and Visual Basic without having a bull's notion of how
    computers actually work (e.g. CPU registers).

    If you don't know how redirection works (i.e. pointers), then you're not a
    programmer in my books.



    > I was going to learn
    > C++ but if times are changing I think I will just learn C#, it seems
    > more modern. I also thought about Java but its WAY too slow. I think
    > it should be easy to learn as I have heaps of experience making complex
    > programs using all versions of Visual Basic.



    C# is just another half-baked atrocity from Microsoft. If were to give
    programming advice to a beginner, I'd tell them to stay WELL AWAY from
    Microsoft.

    I use C++ for every programming purpose. If I can't find a C++ compiler for
    my platform, then I program in C.

    Other than that, I'd write the odd bit of assembly.

    --

    Frederick Gotham
    Frederick Gotham, Nov 21, 2006
    #4
  5. Master Programmer

    kwikius Guest

    Frederick Gotham wrote:
    > Master Programmer:
    >
    > > I heard from a friend that C++ is mainly being replaced as language of
    > > choice for most C++ programmers around the world. I guess this makes
    > > sence as it means that when learning you dont have to f*** around
    > > sencelessly with low level garbage like pointers.

    >
    >
    > (We curse for a reason. If you blend them through your regular everyday
    > speech, you reduce their efficacy when actually feel a need to use them.
    > And it's unpleasant to the untrained ear.)
    >
    > It really depends how dumb a programmer you want to be. You program in the
    > likes of Java and Visual Basic without having a bull's notion of how
    > computers actually work (e.g. CPU registers).


    I think that makes sense when you are working on a manageable size
    system. Once you get into larger scale stuff you really don't want to
    know about it I reckon. Optimisation can wait.

    What Java and Visual Basic and C# are about is getting common tasks
    done easily in their domain A lot of the stuff is helpful utilities
    like source code documentation and reflection which make life much less
    tedious... and comprehensive libraries

    IMO C++ doesnt pay enough attention to the basics like this and because
    it is so hard to learn in the first place that is more important than
    for other languages. OTOH after becoming proficient in C++, my
    experience of programming in VB or Java is that its a pretty sad
    business. VB is incredibly verbose from waht I remember and AFAIK Java
    basically does do "evrythings an object" but you cant work properly
    with value types .

    However for the VB Java and C# programmers out there I guess its a case
    of if you never had it you won't miss it ! Maybe though there is the
    odd one that thinks... hmm I wish I could do... and then maybe they
    will see what C++ is about.

    regards
    Andy Little
    kwikius, Nov 21, 2006
    #5
  6. Master Programmer

    terminator Guest

    On Nov 21, 5:09 pm, "kwikius" <> wrote:
    > Frederick Gotham wrote:
    > > Master Programmer:

    >
    > > > I heard from a friend that C++ is mainly being replaced as language of
    > > > choice for most C++ programmers around the world. I guess this makes
    > > > sence as it means that when learning you dont have to f*** around
    > > > sencelessly with low level garbage like pointers.

    >
    > > (We curse for a reason. If you blend them through your regular everyday
    > > speech, you reduce their efficacy when actually feel a need to use them.
    > > And it's unpleasant to the untrained ear.)

    >
    > > It really depends how dumb a programmer you want to be. You program in the
    > > likes of Java and Visual Basic without having a bull's notion of how
    > > computers actually work (e.g. CPU registers).I think that makes sense when you are working on a manageable size

    > system. Once you get into larger scale stuff you really don't want to
    > know about it I reckon. Optimisation can wait.
    >
    > What Java and Visual Basic and C# are about is getting common tasks
    > done easily in their domain A lot of the stuff is helpful utilities
    > like source code documentation and reflection which make life much less
    > tedious... and comprehensive libraries
    >
    > IMO C++ doesnt pay enough attention to the basics like this and because
    > it is so hard to learn in the first place that is more important than
    > for other languages. OTOH after becoming proficient in C++, my
    > experience of programming in VB or Java is that its a pretty sad
    > business. VB is incredibly verbose from waht I remember and AFAIK Java
    > basically does do "evrythings an object" but you cant work properly
    > with value types .
    >
    > However for the VB Java and C# programmers out there I guess its a case
    > of if you never had it you won't miss it ! Maybe though there is the
    > odd one that thinks... hmm I wish I could do... and then maybe they
    > will see what C++ is about.
    >
    > regards
    > Andy Little- Hide quoted text -- Show quoted text -


    I see you are perfectly executed here.So let me put it short :power
    needs responsiblity and C++ gives you the power.Choice is up to you .I
    believe that C# is
    better than VB _ after all it is immitating(steeling) C++`s syntax.BUT
    replacing C++ with C# looks like a joke.things are easier with C# if
    you wanna beg uncle BILLY all the time.but if you wanna live
    independent...C++ still wins.
    terminator, Nov 21, 2006
    #6
  7. Master Programmer

    Noah Roberts Guest

    Master Programmer wrote:
    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world.


    The only kernel of truth in that is that Microsoft has decided to
    depricate win32 and so the only way to run truely native code will be
    with the .NET framework. This means C++/CL or some other .net
    language. There is still billions of lines of code in C++ on other
    platforms though.

    > Thanks
    > The Grand Master


    That's a pretty dubious title.
    Noah Roberts, Nov 21, 2006
    #7
  8. Master Programmer

    Jack Klein Guest

    On 21 Nov 2006 01:32:09 -0800, "Master Programmer"
    <> wrote in comp.lang.c++:

    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world. I guess this makes
    > sence as it means that when learning you dont have to **** around


    *plonk*

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Nov 21, 2006
    #8
  9. Master Programmer

    red floyd Guest

    Jack Klein wrote:
    > On 21 Nov 2006 01:32:09 -0800, "Master Programmer"
    > <> wrote in comp.lang.c++:
    >
    >> I heard from a friend that C++ is mainly being replaced as language of
    >> choice for most C++ programmers around the world. I guess this makes
    >> sence as it means that when learning you dont have to **** around

    >
    > *plonk*
    >


    <HUMOR>
    Hey, Jack, don't plonk the guy. He must know what he's talking about,
    after all, he's a "Master Programmer".
    </HUMOR>

    (Humor tags added for the humor impaired, in compliance with the ADA).
    red floyd, Nov 21, 2006
    #9
  10. DragonSt0rm wrote:

    > So, the classical C++ paradigm:
    >
    > x=new X(); ..... do work here .....; delete x;


    This is a C++ paradigm?
    Looks more like a C one to me.

    This is an example of the kind of things you must not do in C++.
    Mathias Gaunard, Nov 21, 2006
    #10
  11. Master Programmer wrote:
    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world. I guess this makes
    > sence as it means that when learning you dont have to **** around
    > sencelessly with low level garbage like pointers.


    If you're playing around with low-level things like pointers in C++
    you're probably doing things wrong.

    References are way better for anything when the data doesn't need to be
    owned but only referenced.

    When the data needs to be owned by an object, the way to free it must be
    inside its destructor to follow RAII and ensure exception safety.
    Therefore it must be wrapped.

    Currently, the only good usage for raw (non-wrapped) pointers I can find
    is indexes.

    If the current proposal for GC in C++ goes in, using raw pointers
    everywhere will become valid though.
    Mathias Gaunard, Nov 21, 2006
    #11
  12. Master Programmer

    Guest

    Master Programmer wrote:
    > I heard from a friend that C++ is mainly being replaced as language of
    > choice for most C++ programmers around the world. I guess this makes
    > sence as it means that when learning you dont have to **** around
    > sencelessly with low level garbage like pointers. I was going to learn
    > C++ but if times are changing I think I will just learn C#, it seems
    > more modern. I also thought about Java but its WAY too slow. I think
    > it should be easy to learn as I have heaps of experience making complex
    > programs using all versions of Visual Basic.
    >
    > Any comparisons out there?
    >

    This guy's a troll. He's posted similar messages to the Java and VB
    newsgroups claiming the respective languages will be "phased out" or
    some other nonsense. Master Programmer, indeed.
    , Nov 21, 2006
    #12
  13. Master Programmer

    Howard Guest

    "Mathias Gaunard" <> wrote in message
    news:456333f8$0$20314$...
    > DragonSt0rm wrote:
    >
    >> So, the classical C++ paradigm:
    >>
    >> x=new X(); ..... do work here .....; delete x;

    >
    > This is a C++ paradigm?
    > Looks more like a C one to me.
    >
    > This is an example of the kind of things you must not do in C++.
    >


    Eh? So C includes new and delete now? I'm pretty sure they're C++
    constructs. (C uses malloc and free.)

    Perhaps you're referring to a preference of avoiding pointers when possible?
    Or the use of the RAII paradigm? In any case, that's pure C++ code as far
    as I can tell.

    -Howard
    Howard, Nov 21, 2006
    #13
  14. Master Programmer

    Howard Guest

    <> wrote in message
    news:...
    >
    > Master Programmer wrote:
    >> I heard from a friend that C++ is mainly being replaced as language of
    >> choice for most C++ programmers around the world. I guess this makes
    >> sence as it means that when learning you dont have to **** around
    >> sencelessly with low level garbage like pointers. I was going to learn
    >> C++ but if times are changing I think I will just learn C#, it seems
    >> more modern. I also thought about Java but its WAY too slow. I think
    >> it should be easy to learn as I have heaps of experience making complex
    >> programs using all versions of Visual Basic.
    >>
    >> Any comparisons out there?
    >>

    > This guy's a troll. He's posted similar messages to the Java and VB
    > newsgroups claiming the respective languages will be "phased out" or
    > some other nonsense. Master Programmer, indeed.
    >


    Master "Baiter", more like. :)
    Howard, Nov 21, 2006
    #14
  15. Master Programmer

    Howard Guest

    "Mathias Gaunard" <> wrote in message
    news:4563362e$0$11325$...
    > Master Programmer wrote:
    >> I heard from a friend that C++ is mainly being replaced as language of
    >> choice for most C++ programmers around the world. I guess this makes
    >> sence as it means that when learning you dont have to **** around
    >> sencelessly with low level garbage like pointers.

    >
    > If you're playing around with low-level things like pointers in C++ you're
    > probably doing things wrong.


    Using pointers is not *wrong". They're in the language for a reason, and
    they work quite well. There are safer ways to accomplish most things, but
    that doesn't make using them wrong.

    >
    > References are way better for anything when the data doesn't need to be
    > owned but only referenced.
    >
    > When the data needs to be owned by an object, the way to free it must be
    > inside its destructor to follow RAII and ensure exception safety.
    > Therefore it must be wrapped.


    "Must be wrapped"? Well, you could also simply include the object as a
    simple member. Not everything has to be dynamically allocated, (whether
    that's using smart pointers or raw pointers).

    >
    > Currently, the only good usage for raw (non-wrapped) pointers I can find
    > is indexes.


    If you've got the luxery of writing all the code you use yourself, and never
    interfacing with any code that expects or returns pointers, more power to
    you.

    But I like my pointers, I need my pointers, and nobody's gonna deprive me
    of 'em! :)

    -Howard
    Howard, Nov 21, 2006
    #15
  16. Master Programmer

    Bo Persson Guest

    Howard wrote:
    > "Mathias Gaunard" <> wrote in message
    > news:456333f8$0$20314$...
    >> DragonSt0rm wrote:
    >>
    >>> So, the classical C++ paradigm:
    >>>
    >>> x=new X(); ..... do work here .....; delete x;

    >>
    >> This is a C++ paradigm?
    >> Looks more like a C one to me.
    >>
    >> This is an example of the kind of things you must not do in C++.
    >>

    >
    > Eh? So C includes new and delete now? I'm pretty sure they're C++
    > constructs. (C uses malloc and free.)
    >
    > Perhaps you're referring to a preference of avoiding pointers when
    > possible? Or the use of the RAII paradigm? In any case, that's
    > pure C++ code as far as I can tell.
    >


    But the paradigm is pure Java. :)

    The C++ idiom is

    {
    X x;
    // do some work here
    }
    // x has gone out of scope, and is destroyed.


    Bo Persson
    Bo Persson, Nov 21, 2006
    #16
  17. Master Programmer

    Howard Guest

    "Bo Persson" <> wrote in message
    news:...
    > Howard wrote:
    >> "Mathias Gaunard" <> wrote in message
    >> news:456333f8$0$20314$...
    >>> DragonSt0rm wrote:
    >>>
    >>>> So, the classical C++ paradigm:
    >>>>
    >>>> x=new X(); ..... do work here .....; delete x;
    >>>
    >>> This is a C++ paradigm?
    >>> Looks more like a C one to me.
    >>>
    >>> This is an example of the kind of things you must not do in C++.
    >>>

    >>
    >> Eh? So C includes new and delete now? I'm pretty sure they're C++
    >> constructs. (C uses malloc and free.)
    >>
    >> Perhaps you're referring to a preference of avoiding pointers when
    >> possible? Or the use of the RAII paradigm? In any case, that's
    >> pure C++ code as far as I can tell.
    >>

    >
    > But the paradigm is pure Java. :)
    >
    > The C++ idiom is
    >
    > {
    > X x;
    > // do some work here
    > }
    > // x has gone out of scope, and is destroyed.
    >


    Yep, I agree that's the "preferred" method in C++, but the statement that
    new/delete is a C paradigm is what I was arguing against. It's not even
    available in C, so it can't be a C paradigm.

    -Howard
    Howard, Nov 21, 2006
    #17
  18. Howard wrote:

    > Eh? So C includes new and delete now? I'm pretty sure they're C++
    > constructs. (C uses malloc and free.)


    Paradigms are general things.
    I'm not talking about new and delete specifically.


    > Perhaps you're referring to a preference of avoiding pointers when possible?
    > Or the use of the RAII paradigm? In any case, that's pure C++ code as far
    > as I can tell.


    I am refering to RAII, indeed.
    All resources should be freed in destructors. This is the only good way
    to make code exception-safe.
    Mathias Gaunard, Nov 21, 2006
    #18
  19. Howard wrote:

    > "Must be wrapped"? Well, you could also simply include the object as a
    > simple member.


    I'm talking about pointers here. Pointers to dynamically allocated data
    need to be wrapped.
    Why are you even mentioning (automatic) objects?


    > Not everything has to be dynamically allocated


    I personally don't do it much, but all those people fans of Object
    Oriented Programming need it for polymorphism.


    > But I like my pointers, I need my pointers, and nobody's gonna deprive me
    > of 'em! :)


    Feel free to write bad, exception unsafe and leaky code.
    That's not my problem.

    >
    Mathias Gaunard, Nov 21, 2006
    #19
  20. Master Programmer

    DragonSt0rm Guest

    Bo Persson wrote:

    >> Perhaps you're referring to a preference of avoiding pointers when
    >> possible? Or the use of the RAII paradigm? In any case, that's
    >> pure C++ code as far as I can tell.

    >
    > But the paradigm is pure Java. :)
    >
    > The C++ idiom is
    >
    > {
    > X x;
    > // do some work here
    > }



    It is also the C++ paradigm when due to some other restriction you have to
    allocate on heal instead of the stack.

    Consider for example an embedded (or old DOS) system with a small stacksize,
    where you have to allocate a RGBA image of 500x300 pixels. You can't do
    that on stack. The "invention" of smartpointers (like auto_ptr) was fueled
    exactly because of the fact that this paradigm was widely used.

    Yes, strangely enough for Mathias, the new/delete operators preceded the
    auto_ptr in the C++ (not C) language history :)
    The fact that is modern days, it is thought at the same moment, it is a
    mater of evolution of language and of the teaching methods. But it wasn't
    always that way. Borland 1.0 didn't knew about templates at all.

    So, from the historical perspective I was talking about (when Java was
    designed) what I presented there IT WAS the standard C++ paradigm.
    Java tried to eliminate the "delete problem" by introducting the GC, yet
    this generated a whole set of issues related to nonmemory resource
    allocation/disposal. So, in the end the x.Dispose() become the second
    nature of java programmers, as like delete x is for C++ programmers.
    DragonSt0rm, Nov 22, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,320
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    526
    SpamProof
    Oct 21, 2003
  3. Jim Hill
    Replies:
    3
    Views:
    388
    Jim Hill
    Feb 12, 2007
  4. *Prot3anThr3ad*

    old repository for old C++ source code

    *Prot3anThr3ad*, Sep 29, 2006, in forum: C++
    Replies:
    6
    Views:
    364
    *Prot3anThr3ad*
    Oct 2, 2006
  5. John Henry
    Replies:
    24
    Views:
    989
    alex23
    May 30, 2008
Loading...

Share This Page