Fatal Error

Not sure if this this is just me, but I was tinkering with the TEXT parameters and put variables types in the wrong order. Using UE 5.0.2, VS Community 2022 (As IDE as well as compiler). Does this always happen?

1 Like

Yes, they always need to be in the correct order.

1 Like

Yes. Ideally this would be something the compiler ought pickup. However due to the extreme flexibility of C++ , the language does permit weird nonsense where you might say take the first character of an ascii string, but dump it as an integer (I dont know, maybe you want the ascii code) or whatever. So the compiler goes “Ok, you know what your doing! Im a mere computer and will permit this ridiculous thing, boss!”, and compile it. Then it gets to that data and it turns out you’ve told it the memory position of a string is whats really a float and so when it tries to read past the allocated space the operating system freaks out and kills it. Congrats, you just speedrun babbys first buffer overflow :). Generally more modern languages take a slightly more supervisory role and will stop the stupid thing at compilation, even though this does sacrifice a little more flexibility. As a stopgap, good IDEs generally have pretty good static analysis and will throw red lines under things it suspects of being a shotgun blasted foot. Choose to ignore those red lines at your peril!

So yeah, when it comes to C++ with great power comes great responsibility and oooh so many opportunities to take a rifle and fire it at your foot.

Next up, the joys and terrors of null values!

1 Like

A safer alternative:

By using names, there is no risk of a wrong order. Moreover, without a format specifier, there is no risk of using the wrong type specifier

1 Like

Privacy & Terms