×
Login Register an account
Top Submissions Explore Upgoat Search Random Subverse Random Post Colorize! Site Rules Donate
5
4 comments block


[ - ] Autismo -1 points 13 hoursMay 1, 2025 17:23:59 ago (+0/-1)

Coding is for faggots

[ - ] xmasskull 0 points 16 hoursMay 1, 2025 13:49:14 ago (+0/-0)

de-bug? Use "Raid"!!

[ - ] lord_nougat 3 points 16 hoursMay 1, 2025 13:54:26 ago (+3/-0)

I want to put all the bugs back into all the code I did for the company that laid me off. How to rebug code effectively!

[ - ] SithEmpire 2 points 2 hoursMay 2, 2025 03:49:15 ago (+2/-0)

1. Thwart test cases

After reviewing how code is tested, think carefully what isn't being tested. Instead of telling anyone, put code which causes those untested failure modes straight into production.

2. Leak memory gradually

Overt and explicit allocation will be found out. Instead, choose one of the platform's container-like data structures (even just a string) and hide an instance of it somewhere. Append items to it occasionally.

3. Introduce statefulness

Functions with side-effects are perfect for passing tests but failing eventually in production, eventually returning different results or aiding a gradual memory leak. Cite logging/profiling as the unassailable justification for keeping static variables.

4. Embrace UB

Keep a personal catalog of statements and function inputs which are undefined/invalid and don't cause compile/runtime warnings. Some C++ statement examples are "i = ++i + i++" (same-variable assign, pre-increment and post-increment), and recasting pointer types to structures which may not be the same size. Bonus for combining those.

Functions/APIs are a more fertile UB source; look for non-throwing calls which produce unpredictable results when provided numbers out of range, empty lists and other inputs not listed/considered.