Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

small refactoring in findreplacedlg

<< < (2/2)

oBFusCATed:
Why is this static -> "static const unsigned int max_value"?

MortenMacFly:

--- Quote from: oBFusCATed on January 21, 2016, 09:03:29 pm ---Why is this static -> "static const unsigned int max_value"?

--- End quote ---
Because it must not be instantiated every time you can this function. A member var would also have been fine, but its used only there, locally and not by other methods.

oBFusCATed:
I hope you know that in c++11 and on linux. Every local static variable is protected by a mutex/atomic.
I don't know if this is the case for static const variables, but it should be kept in mind when using static.
Especially when the variable is not a basic type.

For this case it probably doesn't matter, but I just wanted to express my concern about this construct.

MortenMacFly:

--- Quote from: oBFusCATed on January 22, 2016, 08:00:11 pm ---For this case it probably doesn't matter, but I just wanted to express my concern about this construct.

--- End quote ---
OK, point taken.

Navigation

[0] Message Index

[*] Previous page

Go to full version