|
-
Aug 7th, 2012, 09:57 AM
#1
Thread Starter
Lively Member
C# syntax compared to C++
hi,
Im just starting out with C#, and is it the syntax very similar to C++? I have been doing a little C++ over the summer and i am finding the syntax of C# similar to C++ like instance the If statements, ETC. However what i found is different is like creating arrays and stuff.
-
Aug 7th, 2012, 10:46 AM
#2
Re: C# syntax compared to C++
Similar, but C++ is a monster (not in a good way) compared to C#:
1. Compare C++ function pointers with C# delegates.
2. C++ #define macros can quickly reduce C++ code to undecipherable rubbish.
3. C++ array syntax only works in some situations - in others you have to resort to pointers. Also, you can't have an array as a function return type in C++.
4. C++ is unmanaged - no garbage collection.
You need a lot of experience in C++ to produce even the simplest applications.
C++/CLI addresses some of the issues, such as garbage collection, but almost no one uses it and the syntax for arrays and properties are cumbersome compared to C#.
-
Aug 10th, 2012, 06:11 AM
#3
New Member
Re: C# syntax compared to C++
C# syntax is very much easier than C++. You can easily write code in C#.C# programs run very fast and also compile.
immobilier international
-
Aug 10th, 2012, 08:23 AM
#4
Re: C# syntax compared to C++
Because C# is loosely based on C/C++ and was designed to attract C/C++ developers to .NET it has a lot of similarities. I'd even go so far as to suggest that C# has as much in common with C/C++ as VB.NET has in common with VB Classic (VB 6 and earlier). The C language part of it itself is the same, just like the VB language is the same... the changes come with the framework and the other additions. That and the fact that C# is a managed language while C++ isn't. Generally speaking that means C++ is less forgiving and will let you make unsafe calls into places you may or may not want to. C# is less forgiving and will attempt to prevent you from shooting yourself in the foot, if it can.
-tg
-
Aug 24th, 2012, 02:34 AM
#5
Re: C# syntax compared to C++
Hi,
[However what i found is different is like creating arrays and stuff.]
I'm referring to your array statement.
If you have done some Visual C++.NET as I did before, then creating list/arrays is somehow similar.
Have a look at MSDN.
http://msdn.microsoft.com/en-us/libr...h2ey19.aspx#Y0
Greg
-
Aug 24th, 2012, 07:44 AM
#6
Fanatic Member
Re: C# syntax compared to C++
Nobody has mentioned the similarities between C# and Java.
http://en.wikipedia.org/wiki/Compari...Sharp_and_Java
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|