News for hackers. Stuff that matters.
Re:3 lines of code shouldn't take all day by GreenWatermelon on Thursday December 16, 2021 @05:19AM (#29576830)
Getting a particular piece if code running from the first time is so unexpected that I'm like "Huh... that's pretty cool" everytime it happens.

no need to spend 3 more minutes looking at the code when a 2 seconds build will tell me there's a Segmentation fault right there, or when Valgrind will tell me I missed a free ().

Re:3 lines of code shouldn't take all day by patrakov on Thursday December 16, 2021 @11:04AM (#29579579)
Well, yesterday I made a rather significant change to the code. Essentially, a reimplementation of an existing function in a completely different way, to avoid a memory consumption issue that cannot be solved in the old approach. 68 insertions, 15 deletions. It, unexpectedly, worked correctly and passed all tests from the first attempt, even though there are threads involved, and they are my weak point. But I didn't have a "Huh... that's pretty cool" moment. I had an "I don't like this code, it's too complex, it must be wrong somehow" moment.
Re:3 lines of code shouldn't take all day by johnny22 on Thursday December 16, 2021 @08:59PM (#29586829)
or just feel both.. at the same time.
Re:3 lines of code shouldn't take all day by mannykannot on Thursday December 16, 2021 @09:03AM (#29578165)
Only a small fraction of segmentation-fault-causing errors will be revealed in 2 seconds of testing. Thinking about all the ways your code could fail, and being able to keep a mental track of the constraints you need to observe, is a useful skill to acquire.