Quote:
Originally Posted by Sithis
C++ is supposed to be faster. However, I don't see why you would use C++ when you can use C# as well (SampSharp).
C# is much more suitable for SA:MP because it's a business language that you can use to interact with your database on a high level.
Pawn isn't a very well made language at all. No object oriented programming, no multi threading, etc..
|
I don't think anyone would use C++ over PAWN just for plain speed improvement. Pawn isn't so slow that you could do way more in C++. It's most likely the style and features that get you to use C++.
Some more advantages of C++ (many of them would also apply to C#, Java, Lua etc) are:
- A language that is used not only for SAMP, Pawn isn't really used in many projects. Search for Pawn in a Search Engine and most of the results will be SAMP related (except results related to the language itself). So getting help on certain issues may not require you to ask in this forum, or someone who knows Pawn.
- Non-SAMP specific libraries that you could directly include and use without writing a wrapper-Plugin. Some of them aren't really possible to port to PAWN even (although that is only the case rarely, I guess).
- Language features. C++ is way more dynamic and you can do a lot more without any additional library. Besides dynamic memory allocation, there are real data types (which means more efficient data storage), data structures (structs, real Vectors & Maps, etc - without relying on 3rd party addons) and much more. Using these in Pawn will still require you to buffer certain data in the VM's memory, in C++ however you won't need to.
- If you learn Pawn, you will probably only learn it for SAMP and never use it anywhere else. If you learn C++, you will be able to use that knowledge for projects outside of SAMP later, even in case you quit SAMP (this is obviously not a reason to use C++, but a nice side-effect if you do so anyway)
Many of these things can also be achieved by writing a Plugin, but that's not really the same.
Disadvantages:
- You should have some knowledge already, otherwise you won't know what you are doing. Pawn is much easier, modifying a Script is easy even if you're not into programming or scripting at all (to a certain degree, of course).
- Doing a small mistake in Pawn will crash the server at most (if you are really unlucky you mess up player accounts or something). Doing a small mistake in C++ may get unnoticed for weeks, but actually screw up many parts of the server (not only your gamemode), causing weird issues you may not be able to link to that mistake. Unlikely, but possible.
Related to that, pure Pawn is free of Memory Leaks and similar issues.
These two disadvantages however aren't really disadvantages, it's just obvious that a way more powerful language is also more complicated and prone to critical mistakes.
Probably the most annoying one is Windows/Linux. Every Pawn Script will run on both OS, a C++ gamemode/plugin must be compiled for the specific OS. But if you manage to do that, I don't really see a disadvantage in using C++ if you know what you are doing.