Category: refactoring
Consider the following C/C++ function to count the number of trailing zeros for a integer (in binary form): static inline int count_trailing_zeros(int value) { int n = 0; while …
This is a legacy code snippet that uses the magic goto, which I find it very difficult to understand and refactor. doit: foreach (var line in dict.Values) { var …
When your code has performance bottlenecks, you can use the profiler software to benchmark your code, which will reveal the potential problems in your code or modules (memory or …
I am starting a series of code refactoring examples as I see them a lot from time to time. Today, I read the following piece of code in our …
Background I was asked by my manager to optimize a piece of code that has been in the code repository for like 4 years. Actually, that particular piece of …