Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / C (plus) (plus) vs C (sharp)

Author
Message
npsken
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: MA,USA
Posted: 2nd Jul 2007 05:29
Ok, first a quick explanation for the subject line: I got the error message "Too many non-alphanumeric characters in your subject, please revise."
---
As I understand C++ would be faster than C#, but I am concerned that C++ would be harder to learn.

Is there a possibility that somebody could show some darkGDK C++ and C# code that does the same thing so I can see the difference?

Thanks in advance.

kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 2nd Jul 2007 18:30
Hi npsken,

The thing here is about choosing what you want the most: Faster runtime speed (although I don't think the difference will be thaaaaat great) or Faster Development?

Both languages have the same syntax and also, DarkGDK commands are almost the same in both of them.

One thing that will probably help you deciding is "in what programming languages do you have some kind of experience"? If you are a Basic(DB,VB,etc) or a Pascal/Delphi guy, I think you'll probably be more comfortable with C# and DGDK.NET (or maybe VB.NET with DGDK.NET).

Also, if you take a look at some of this forum, you'll know that I developed a 100% Object Oriented plugin for DGDK.NET, it's called LightEngine. If you really like OOP then it is a great help, as some of the users stated (no worrying about IDs, intellisense helps with all the commands available for that kind of object, etc). Up to now, there's no equivalent for the C++ version.

I hope this helps, and any other questions, feel free to ask.

Best regards,
Thiago
Chalkey
17
Years of Service
User Offline
Joined: 25th May 2007
Location:
Posted: 3rd Jul 2007 01:33
To npsken,

First off, an alphanumeric character is a set of all the letters A to Z and the numbers 0 to 9. I guess a nonalphanumeric character is something such as '%' or '@'.

As kBessa has said you probably wouldnt notice the speed difference between C++ and C# and because both languages use the same syntax the only big difference between them is the way you implement them.

C# uses an object orientated method where all like objects are arranged into 'classes'. Although C++ supports classes you can write programs in a procedural manner, that in my opinion are easier to learn and understand. To help sum this up here are two console programs (one C++ the other C#) that print out the infamous 'Hello world'...

C Plus Plus


C Sharp


I completed a degree in Software Engineering were we learnt a lot of C++ and Java. Java is similar to C# in the way it is an object orientated language, and in my opinion I found learning C++ was easier because I did not have to grasp the OO concept. Due to my fondness of C++ I decided to purchase the DarkGDK version and not the .NET.

I hope I've helped!
Chalk
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 9th Jul 2007 21:07
I think we made a good choice with the C++ version. I like the closeness to the CPU/Assembly Stuff - while still having the same abilities to makes classes etc.

Just my opinion.

Jason

Know way too many languages - Master of none
cypher0
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location:
Posted: 30th Jul 2007 03:27 Edited at: 30th Jul 2007 03:28
Theres no major speed difference between C++ and C#, though you might notice C# programs take a little longer to get started (also DGDK.NET is slower than DGDK due to the interop).

The code above however is a little biased at C++ being the shorter.
The C# version does more than the C++ version - it references a library that is not used, takes a command line and also defines a namespace, a more correct correct C# equivalent would be:



or vice versa in C++ (no one would ever seriously use this method though!):


As for which is easier to learn, that depends on your personal preference, I would't say either is harder, they are both simple and confusing in their own ways. C++ is more linear and structured, C# is better arranged into classes and objects allowing the IDE to speed up development considerably. You could also try Visual Basic, which isn't that different from C#, but takes from the more human-readable BASIC syntax.

If in doubt use C++ - you can always use C++.NET if you change your mind then!
Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 30th Jul 2007 17:17
Quote: "C++ is more linear and structured, C# is better arranged into classes and objects allowing the IDE to speed up development considerably."


gotta disagree with you on that cypher...

BASIC is linear... c is linear... c++ is OOP...

now, while you can code c++ in a manner like c, you are not taking advantage of the OO nature that it affords...

I use classes almost entirely with c++ (except when i'm doing a direct port of DBPro code)...

the following is a bit of code that uses the engine i'm trying to put together with the GDK using c++... as you can see, it uses classes and objects exclusively...



--Mike
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 30th Jul 2007 21:17
Red, any chance of using SmartPointers, or a Class Factory for creating those objects otherwise it could lead to all sorts of memory leaks if the objects are left to the programmer to free.

Class Factories are good since you then track all object creation, and can free them if accidentally left when the program shut's down.

Paul.

Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 30th Jul 2007 21:35 Edited at: 31st Jul 2007 01:54
good points Paul... right now i've got a generic method that lets the game class signal all objects just prior to shutdown... but if the program is unexpectedly terminated, there's no guarantee what's gonna happen...

this is where c# has a slight advantage (some would say), as a lot of the housekeeping chores and 'garbage collection' are handled automatically...

i'm still in the begining of fleshing out this thing, so there's a few things i still need to do and check before i can reliably use it...

thx for the heads up...

--Mike
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 31st Jul 2007 01:10 Edited at: 31st Jul 2007 01:11
On the contrary, all memory used up by an application is freed when it terminates. Memory leaks only persist in the duration of running the app. The exception is shared memory I believe.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 31st Jul 2007 01:20
It still reflects good coding ethics though

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 31st Jul 2007 01:22
I do agree there.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 31st Jul 2007 02:20
Here Here!

APEXNow - You caught my eye with the Term "Class Factories" ... I've been doing that for a long time - with double linked lists (A class) that allowed various "SQL like" searching for stuff, type, name, description (Useful for debugging) Getting stats on instanced things - how long instanced etc.... I never knew it had a name... at least it sounds like what I made and use a lot (Did this very heavily in FreePascal starting with my own base class - IMHO the BEST way to really know what's happen'nin unda the hood

Jason P Sage

Know way too many languages - Master of none

Login to post a reply

Server time is: 2024-11-19 15:37:46
Your offset time is: 2024-11-19 15:37:46