More Information about TEXT macro?

For the longest time, whenever I create any form of display string in UE4, I would wrap the TEXT macro around it. I need to know more about the macro because I do want to avoid using it at times where verbosity matters.

From a high level perspective, I expect the TEXT macro to do some platform specific text encoding - whether that is exactly what it does, I do not know.
For my scenario, I am attempting to do comparisons between FName objects, I DO NOT care about the display of the text; should I still wrap my initialization with the TEXT macro?

If the macro really does convert between encoding types behind the scenes, does that not mean that equality comparisons might differ as the underlying size of the data is different; hence I am highly encouraged to use TEXT() anyways?

3 Likes

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/68748-what-does-text-do

Take a look at this post for a sort of nutshell meaning of what TEXT macro does.

If I wasn’t at work, I would tell you what I see from examining the macro from VS. I’d highly recommend taking a look at it via source

1 Like

From what I remember at the old times starting development of Windows applications, TEXT macros would be placed around strings to locate the strings which you want the compilation to differ where it should be considered a Unicode String or a MBCS (MultiByte Character sets)… Nowadays it is a sort of legacy method, since there is no real reason on the target platforms to not use Unicode, so if you want to keep your code consistent you should still use it, because mainly we never know when a macro would change and future changes on string standards would clearly target the TEXT macro to have its content change to accomodate the changes.

All TEXT() does now is add L in front of the string.

2 Likes

thanks that is a nice shortcut…