Thank you guys
UE4 has garbage collection but it’s a mistake to think that means you don’t need to worry about memory allocation.
I don’t quite understand what you mean about performance? Are you saying that C# is faster than C++? Cause that’s not the case.
I think you missed my point about scripting languages. 10 times slower is fairly standard for any scripting language. The reason being it’s compiled to bytecode and run on a virtual machine that runs on top of the C++ API. Unity works the same way. The bottleneck is the communication between the virtual machine and the native code not anything to do with the language itself. C# or Lua would still have to do this, there’s no reason to think they would run any substantially faster.
[/QUOTE]
Oh Geez… memory management… not again! :(… :o
I think we had a communication issue :). I was saying that there’s no way C# is going to be 10x slower than C++ imo. At least not for a self-contained stress code. Obviously if you’re calling C++ code then the execution performance would be the C++'s but there’s an overhead (and there’s the execution performance of the C# code itself). In any case, I don’t understand the ‘10 times’ figure. There was a discussion in the past about the overhead of the Box2D wrapper used in libgdx, and the conclusion was the overhead is negligible.
I thought that ‘10 times slower’ number was for example for a benchmark like mandelbrot running contained on blueprint-only code. Then it would be okay imho because most/some of the time blueprint would be just calling C++ code, so the low-performance logic would be used only for linking the data in C++ functions, but it seems that ‘10 times slower’ number is from a real-life application, so I’m assuming that only to pass data between C++ functions blueprint takes so much time that in the end the whole shebang ends up 10 times slower.
Once I start using UE4 I’m going to do some serious benchmarks, because that’s not a discussion that will be settled with assumptions. We need real numbers.
What struck me most when I started with C++ (coming from Delphi), is the poor native string handling in C++. I was used to have “string” as a standard native datatype which can be used with the standard operators to concatenate them, or iterate over them by treating them as an array of char…
Another thing is the use of braces over keywords. I know, it more compact and tech-looking to use {} instead of “begin” and “end”, but visually I like it better than a cluttered set of braces. Especially when it comes to nested statements. I dont like the use of = and ==… In Delphi an assignment is x := 42 and a comparison “if x=42”. This avoids the formally wrong statement x=x+5. X is not x+1. Its meant as an assignment, but mathematically, its an incorrect equation… The Delphi way is much more “beautiful”
So I can understand why people would avoid C++.
But there is no way around it.
What I could use though would be a nice tutorial about it. There are many of them out there, but they all have one flaw:
- They either explain C++ in the context of UE4 and assume that you are familliar with C++ in general (syntax and concept wise).
or:
- They explain C++ in a way that is not compatible with UE4.
I followed a tutorial about C++, using Dev-C++. Wuith what I learned, I tried the standard stuff. “Hello World”, Number guessing game, Hangman (where string handling drove me crazy), TicTacToe, etc.
When I then thought I was repared and started with a C++ tutorial for UE4, it seemned that this was a complete new language. So far removed from the C++ that I “learned” in the Dev-C tutorial, that I was more confused than before.
If there were a tutorial that would approach C++ from the UE4 perspective and at the same time recognizing any unfamiliarity with the language by the audience, that would be awesome
I guess only when a programmer is willing to lean a language he does not like, he has the “right stuff”
[/QUOTE]
I agree that strings sucks, but I like braces better than keywords… I like Python’s way even better though :P. I’m so used to using == and = that I couldn’t imagine myself using that language… It’s just part of my subconsciousness I think, just like 0-indexes…
The tutorials that explains C++ in the context of UE4 are enough for me. It’s the same thing with QT, you use only (or mostly) the QT types, so basically you feel like you’re using another language that’s based on C++ because you hardly if ever use the standard C++ stuff, I think it’s the same with UE4, so that’s a big plus.
I got a little uncomfortable with the thing about memory though… I still have nightmares from the days I had to manually deal with memory :(. It’s a modern kind of torture imho.