De-reference

Okay so when we’re logging out from the Elevate function inside TankBarrel.cpp I did play around abit and found something about the UE_LOG that I found kind of strange. So were using * to de-reference valubales before passing them to the stream. Example: *BarrelLocation.ToString(). But when we’re using floats we don’t need to de-reference before passing it to the stream why’s that? how come that a string passed through %s needs to be de-reference but not a float %f?

It’s probobly easier than I think but stil have to ask

Because UE_LOG uses printf to do formatting which is a C function. FString is a user-defined type created by Epic which printf has no knowledge about, it only knows about built-in types.

A string is just an arrary of characters which FString is an abstraction over for dynamically sized strings and also allows easily manipulation of them. Under the hood it will store an array of characters which FString has provided access to by overloading the * operator.

So * gets the internal character array that printf can work with.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.