Re: #qcx CAT control #qcx
toggle quoted message Show quoted text
Yes all agreed... though a novice programmer will find the first version easier to read and understand and change than the second "better" version ;-)
Use of memset will probably slightly increase the code size, all things being equal, because of the function call. the memset() function will get compiled into the executable, instead of code for the for loop. BUT, it has the other big benefit that you didn't mention, that if any other part of your code can also be amended to use memset(), then you will benefit by having two different places call one piece of code (memset) rather than both for loops - which will save some code.
So that's another trick to make programs smaller... anything that can be factored out into its own function and called from multiple different places, will save space (as long as that benefit overcomes the penalty of the function call and the parameter passing - which is sometimes not the case for very simple functions).
Well written code will tend to be nicely arranged into functions collected together into appropriate modules. But if these functions are only called once by one callee... then there is the overhead of the function call and the parameter passing (if any). So sometimes good programming practice works against compact code. It's all tradeoffs...
73 Hans G0UPL
On Thu, Nov 28, 2019 at 5:51 PM jjpurdum via Groups.Io <firstname.lastname@example.org> wrote: