Personal computing discussed
Moderators: renee, SecretSquirrel, just brew it!
ChronoReverse wrote:If you don't have somebody around to look at your code, I've found that rewriting that portion from scratch (and without referring to the original code) has been an effective method of fixing these issues.Time to let someone else take a look at the code? Sometimes the most obvious errors just can't be seen by the writer of the code.
ChronoReverse wrote:Time to let someone else take a look at the code? Sometimes the most obvious errors just can't be seen by the writer of the code.
Ryhadar wrote:Good responses all.
I was actually the one helping someone at their wits end (for a change) and was wondering if there was a term for it.
SecretSquirrel wrote:That said, I have actually run into occasions where the compiler was screwing things up during optimization, but it has always been for small microcontroller environments.
just brew it! wrote:SecretSquirrel wrote:That said, I have actually run into occasions where the compiler was screwing things up during optimization, but it has always been for small microcontroller environments.
I've seen that a fair bit as well, but I've also seen gcc do it on x86 at -O2 and above, especially when the developer makes implicit assumptions about aliasing of values stored at the same memory location (e.g. doing a brute force pointer cast instead of using a union).
SecretSquirrel wrote:The common factor being that the programmer is trying to make use of their knowledge of the hardware to write effecient code -- something you obviously have to do in a microcontroller. The times I've seen it on big platforms, I or someone else assumed that sizeof(void*)==sizeof(int).
Arvald wrote:I work in an environment with 1 other developer on a regular basis. We call each over to look at stuff when it is not working. The peer review 90% of the time we figure out our own mistakes and the other has no clue what they were looking at. There is a shift in your thinking when you are reviewing it with someone else.
The other 10% their different viewpoint finds issues with something your brain has glossed over.
That said I have had some pretty wonky compiler issues over the last 20 years. a bug search can help if you are 100% sure that it is not your code.