B
Bruce F
Why should I use C# programming rather than C++?
Does C# have advantages over C++?
Does C# have advantages over C++?
Why should I use C# programming rather than C++?
Bruce said:Why should I use C# programming rather than C++?
Does C# have advantages over C++?
C# is object oriented and strictly typed. It's used in the .NET
framework so it uses managed code and a garbage collected memory management.
If you like these features, C# would be a better choise.
Pavel said:Techincally, C++ is also object-oriented
and strongly typed.
MC said:I should add that if you are doing low-level systems programming, as
someone else pointed out, C++ (which would actually be barely more than
plain C in that kind of situation) would be advantageous.
The design philosophy of C# is actually derived more from Pascal than from
C. If you like raw pointers and unexplained crashes, look somewhere else
![]()
Yes, but it's not "pure" object oriented in the same manner as C# where
every data type is object oriented and code only exists inside classes.
But not strictly typed...
Mythran said:"raw pointers and unexplained crashes"...well, C# can use pointers
in
marked, unsafe code...
MC said:C# is vastly easier to use than C++ and vastly less error-prone,
without sacrificing computational power.
C++ is a rough prototype of a C-like object-oriented language; Java
and C# are the real thing, and I'll leave it others to explain the
(comparatively minor) advantages of C# over Java.
If you need to run on more than just Windows or more than just PCs, C++.
If you need to talk to hardware, C++. If you need to crunch bits, C++ (C#
doesn't even know that bitwise-and generates a result the same size as its
input).
If you want to do frilly WPF or web stuff or database queries, C#. The
language is simpler which makes it much easier to design tools to work with
it, so there are many more wizards for C#.
Mike Schilling said:In C, it's almost impossible to avoid potentially unsafe constructs like
pointers.
ooooooooooooooooooooooooooooooooooooooBruce F said:Why should I use C# programming rather than C++?
Does C# have advantages over C++?
Michael said:Yes, and neither is Java or C#. Any language which allows anything
like bad_cast or InvalidCastException at run-time is not strictly
typed.
Pavel said:While I mostly agree with this analysis, there are some clarifications
to be made to that.
Mostly true, however, sometimes Mono provides reasonable cross-
platform capabilities, and high-level stuff is so much easier (and
faster) to do in C# that it is often worth it. Be wary of UI, though,
as in my experience WinForms support in Mono is still rather flaky
(and WPF is nonexistent).
Also generally true, however, it's not that often that bit crunching
is all a piece of software has to do; and when it's just a single
routine in a large and otherwise high-level (and therefore C#) app,
it's often less trouble to code it directly in C#. Language provides
all necessary constructs for low-level performance tweaks (unchecked
pointers, unions, and stackalloc - this essentially covers the
entirety of what C has to offer), so it is quite possible to do
creative low-level optimization if needed. Of course, for a large low-
level library, it still makes more sense to do it in C++ (and wrap
using C++/CLI for consumption from C#).
At the same time, when the app is mostly doing low-level stuff, and
the UI is a very thin and marginally small layer, C++/CLI is often
good enough - it has a WinForms designer, the syntax is somewhat more
verbose but clear enough, and overall it can do everything C# can do.
MC said:As I often sum it up, "C# is C++ gone sane."
My understanding is that even the designer of C++ intended it only as
a rough prototype for trying out ideas, and expected it to be
superseded by better-designed object-oriented C-like languages.
Zach said:oooooooooooooooooooooooooooooooooooooo
You will be up to speed much quicker with C#.
Put a query on a C++ use group asking whether
C++ is just C plus OO added on, and watch them
all get hysterical, because that is just what it is. It
is like driving a rally in a T-Ford.
Zach.
Why should I use C# programming rather than C++?
Does C# have advantages over C++?
Why should I use C# programming rather than C++?
Does C# have advantages over C++?
Mark Rae said:Yep, can't argue with any of that...