News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

About the F() macro and wxString::Format

Started by ollydbg, May 11, 2022, 04:20:25 PM

Previous topic - Next topic

ollydbg

I see this commit:

https://sourceforge.net/p/codeblocks/code/12807/

I remember that we have discussed several years ago, that the F() macro is not thread safe, it uses a global variable. So, maybe we will use wxString::Format to replace F()?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Miguel Gimenez

I think the F() macro currently has no advantage over wxString::Format() and complicates the calls unnecesarily, forcing usage of wx_str().
The thread-safe part is one important reason to ditch it.

Also, calls to wxT() and _T() should be removed. There are a lot of code like this:
if (String[n] == wxT('P'))
that creates two temporary wxString and compares them, while this:
if (String[n] == 'P')
does a direct wxChar comparation.

ollydbg

Miguel Gimenez, I agree with your opinion.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.