Quantcast
Channel: Object Mentor Blog: Outliving The Great Variable Shortage
Viewing all articles
Browse latest Browse all 26

"Outliving The Great Variable Shortage" by George Dinwiddie

$
0
0

WRT: “I suggest, in the case of constrained footprint where there truly is a Great Variable Shortage (GVS) that if (and that’s a big if) the author absolutely MUST repurpose variables on the fly that it is the lot of that programmer to make sure that users of the class/struct never have to know that it is being done. Never. Including those writing unit tests. The class will have to keep data-packing and variable-repurposing as a dirty secret.”

Actually, the compiler should do the repurposing for you, and you shouldn’t worry about the number of names in the symbol table. It’s been a long time since I last looked at compiler output, but compilers (since the late 1980’s, anyway) are very clever about figuring out the lifetimes of variables and re-using the space. I found back then that compilers could optimize much better than I could, and I could luxuriate in readable code.


Viewing all articles
Browse latest Browse all 26

Trending Articles