Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,466 members, 7,816,092 topics. Date: Friday, 03 May 2024 at 04:18 AM

Comparing C++ And C# - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Comparing C++ And C# (951 Views)

Help A Friend To Learn Java, Php, C#, C And C++ / Difference Between C, C++ And C# (2) (3) (4)

(1) (Reply) (Go Down)

Comparing C++ And C# by tomX1(m): 5:37pm On Apr 25, 2008
Hi,
I just wanted to know what you guys think of the languages C++ Vs C#.
Honestly, I've never used C#. I am a C++ coder and I've been using that language for years so I am ussualy not so inclined to drop it. When I heard about C#, I wrote it off as another attempt to make a RAD (Rapid Application Development) version of C++ to woo those who are more into VB and such languages. There have been other versions of RAD C++ in the past and they ussualy compromise some of the speed and power that are inherent in core C++.
C# however seems to be gaining a lot of popularity and I'm realy begining to feel left out. If you do use C# and/or C++ please feel free to share your opinion (from personal experiences) on the pros and cons of either languages.
Re: Comparing C++ And C# by sbucareer(f): 6:56pm On Apr 25, 2008

C# is another MS strategy to copy Java language. If you don't understand Java, you will not like C#. Overall, it is a web technology. To learn C# you must be thinking of moving into .NET technologies.

C# is a very powerful .NET architecture that describes the web and internet programming. C# is scalable and very easy to learn. If you know Java, you already know C#.

Albeit, many MS languages is used by .NET i.e. ASP, ASP.NET, C++, to run its .NET infrastructure. I want you to know that MS tried to copy Sun Systems technology at the time when trees looks like ground in the eyes of the monkeys
Re: Comparing C++ And C# by Kobojunkie: 5:10am On Apr 26, 2008
@Poster, Nothing about C# smells of Web technology. it is a full fledged programming language that can do everything you can think of doing with Java or C++, so whichever you choose, you are on the right track but note that since C# is built on C technology, it combines all the power of C++ and much more. If .NET is your thing, there is Visual C++ .NET for you to take advantage of . But C++ remains with better performance level and that is still in use. Below is a sort of list of pros for each , Check it out


http://www.thinkingparallel.com/2007/03/06/c-vs-c-a-checklist-from-a-c-programmers-point-of-view/


Pro C#:

garbage collection
array bounds checking
huge .NET-Framework library
types have a defined size (e.g. a long is 64Bit)
strings are encoded in UTF/16
autoboxing - every type can be treated as if it inherits from object
supports constructor-chaining (one constructor can call another constructor from the same class)
when a virtual method is called in a constructor, the method in the most derived class is used
static constructors (run before the first instance of the class is created)
exceptions have access to a stack trace
advanced runtime type information and reflection
supports variadic functions nicely
built-in support for threads
no need for header files and #includes
no fall-through on switch-statements
arithmetic operations can be checked for overflow if required
objects must have a definite value before being used
attributes can be attached to classes and retrieved at runtime
no forward declarations required, classes can be arranged at will
access to class members / functions is done only by the dot (no more -> or rolleyes
conditional functions (e.g. for debugging)
structs and classes are actually different (structs are value types, have no default constructor in general cannot be derived from)
supports properties
readonly members are const, but can be changed in the constructor
finally block for exceptions
arrays are objects
support for anonymous functions
supports the base keyword for calling the overridden base class

Pro C++

better performance
portability
multiple inheritance
deterministic destruction (allows RAII)
any type can be thrown as exception (only classes derived from System.Exception in C#)
ability to enforce const-correctness
implicit interfaces on generics (in C#, generics must be constrained with an interface)
offers pointers (C# only offers pointers in unsafe mode)
support for macros
support for global variables, functions, constants
allows default arguments on function parameters
STL
supports bitfields

Where C# is just different from C++

value types and reference types exist (struct is value-type, class is reference-type)
value types live on the stack, reference types on the heap
references can point to null (must not be valid)
code is packaged in assemblies in C#
no automatic conversion from int to bool in C#
main-function is called Main in C#
no semicolon after a class declaration in C#
everything derives from object or can be treated as if


Re: Comparing C++ And C# by tomX1(m): 3:51am On Apr 28, 2008
Thanks for your response guys. I've always wondered why many IT firms that provide web solutions insiston employing people who know C# while you will rearly see any advert asking for C++ gurus.
sbucareer:

[font=courier new][size=12pt]
C# is another MS strategy to copy Java language. If you don't understand Java, you will not like C#. Overall, it is a web technology. To learn C# you must be thinking of moving into .NET technologies.

well considering that Microsoft already has Visual J++, why will they have to make a C centric language to mimic Java? Please shed more light on your opinion. Thanks alot.
Re: Comparing C++ And C# by Moluwe: 6:44am On Apr 28, 2008
Nice Read,

(1) (Reply)

Java Problem!need Help / Help Pls: / Pls I Need Help With My Project Topic

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 22
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.