Re: FreeMem()
Posted: Thu Dec 16, 2010 8:28 am
it's about the use of unnecessary variables and code.
When code is shorter, we have less bugs.
Moskito's suggestion adds an extra variable that is unnecessary given how sizeof is used by the compiler. It doesn't make the code any more readable, hence my "joke" about doing it with 4 additional variables for the fun.
Of course I'm only arguing about this because being wrong is one thing, but adding on top of that that the correct code is "ugly" is just gratuitous. I'm the first one to admit when my code is incorrect, but this time, it's the best possible solution, so I don't like being insulted for doing the right thing
When code is shorter, we have less bugs.
Moskito's suggestion adds an extra variable that is unnecessary given how sizeof is used by the compiler. It doesn't make the code any more readable, hence my "joke" about doing it with 4 additional variables for the fun.
Of course I'm only arguing about this because being wrong is one thing, but adding on top of that that the correct code is "ugly" is just gratuitous. I'm the first one to admit when my code is incorrect, but this time, it's the best possible solution, so I don't like being insulted for doing the right thing