4 ms·
I remember years ago my friend was gong to college for CSCI and had to write a malloc for a course. He procrastinated till the last... night... and wrote it. In
by katastic 9y ago
I remember years ago my friend was gong to college for CSCI and had to write a malloc for a course. He procrastinated till the last... night... and wrote it. In the free() routine, he simply wrote "return true;". The TA's unit-tested code because there were over a hundred classmates to test. Well, the unit-tests must not have been very good because he said he scored a 100.
- nightcracker 9y agofree returns void, so even the "return true;" was wrong.
- katastic 9y agoOkay, well, this was a story I was told like 8 years ago when I was back in college. So I'm bound to have mixed up the details. But the event did happen. It passed the unit tests even though he was supposed to manage and free pages.
- specialist 9y agoHa. Ages ago, I was told to add copy protection to one of the products I managed. I didn't want to. Hackers posted cracked versions of our apps within a few days any way. And our legit customers hated it. Our company's QA/Test in charge of these things signed off on my implemention. Surprising. I knew it didn't work (as expected). But what the hell. I embraced her acceptance (buyoff), and burned those gold master CDs, meeting our deadline, pleasing our dealers, and had a new release to show-off at the trade show. Woot. About a year later, this QA/test person figured out that implementation (for that release) never worked. She wasn't very happy with me.
- kristianp 9y ago"I embraced her acceptance (buyoff)". What does that mean? My understanding is that a buyoff is a bribe, but your last paragraph implies it wasn't a bribe.
- specialist 9y agoI meant the tester acknowledging the acceptance tests passed, so we had her approval for release.
- kristianp 9y agoAh ok, signoff then.
- copperred 9y agoSlight tangent here, but this is intriguing to me - the concept of devs ignoring known bugs until they are found by testers. Do other devs struggle with this? Are there certain working conditions that foster this behavior?
- benchaney 9y agoAn empty free function is technically standards compliant.
- jug 9y agoHaha... The irony that his free() probably passed the tests better than complicated solutions that crashed.
- kevin_thibedeau 9y agoFreeRTOSs heap_1 allocator [1] does the very same. Not such a crazy idea for special circumstances. [1] https://github.com/maniacbug/FreeRTOS/blob/1d772c834b2e5e9bf1f41c67525965d78c5470bb/heap_1.c#L130 https://github.com/maniacbug/FreeRTOS/blob/1d772c834b2e5e9bf...
- wepple 9y agoand possibly more secure!