Getting rid of those unsightly temp vars (objective-c)
-
10-10-2019 - |
Pergunta
I have a set of CGFloats used to dynamically calculate height and y-coords for arranging views in my viewDidLoad: method, and once those views are arranged the vars are no longer needed. I was just wondering if there was a way (or even a point) to remove temporary variables within a scope once they're no longer needed, similar to releasing allocations?
Solução
CGFloat
is just a typedef of float
. Local variables of type float
live entirely on the stack and disappear when the function returns, so there is no need to do any housekeeping.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow