Developmental informatics hacker

  • 0 Posts
  • 9 Comments
Joined 1 year ago
cake
Cake day: July 30th, 2023

help-circle


  • I rarely use the debugger. When I do it’s because I’m tired and I always regret it tbh. It’s just a waste of time and clutters my screen.

    The fastest way by far is to simply read and think. You have to do it any way.

    The print is the last resort, I tend to use it maybe once per day. Doesn’t clutter my screen and works with the shortcuts I’m used to. Totally flexible. Can comment out and share with team or reuse later. The issue is often immediately clear.

    For example today I used it on a position after a multiplication with a matrix. I didn’t explicitly convert it from a float3 to a float4, so w was 0, and it caused it to rotate instead of translate the position vector. Once I printed it it became clear.

    Had I just read the code again and thought about what it was actually doing I would’ve found it more efficiently.


  • If you have optimizations enabled this can easily occur due to code being moved around behind the scenes. For example the body of a small function can be inserted where it is called. For example in c# if you get a null ref exception in such inlined code it will actually direct you to the place where the function is called from, rather than its body.

    So if you know, you probably can find the issue. In the worst case just go to debug mode with opti off, or use an attribute on the function to force it not to inline.