During this lecture when explained that we needed to use double asterisk to call PrtLog inside of a text macro, I thought it would make sense if it were inside brackets like so: *(*PrtLog) because this way, you are processing the string of the value that PrtLog is referencing to, inside the macro of TEXT to make it compatible with Unreal. I tried it on my end and it works, but in the lecture Mike uses the expression like this: **PrtLog. This makes me think that the parenthesis is actually not needed in this case because the pointer inside the text macro would read whatever is at its right so it would read *PrtLog regardless if it’s between parenthesis. Am I understanding this right?
You came to the right conclusion but not the correct reason why.
The ()
aren’t needed because there’s no ambiguity as to what **PtrLog
means which is to dereference twice.
If you had a more compilcated expression e.g.
**PtrLog + 1
There’s still no ambiguity due to operator precedence which means the above is the same as
(**PtrLog) + 1
However if you wanted to change the order you would need parenthesis in order to get *(*PtrLog + 1)
which would mean dereference PtrLog then add 1 to it (not valid, you can’t add 1 to an FString) and then dereference the result of that
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.