5 ms·
This reminds me of tests I took in earlier CS classes. Knowing those things are utterly useless in practice.
by _RPM 12y ago
This reminds me of tests I took in earlier CS classes. Knowing those things are utterly useless in practice.
- bgvopg 12y agoWhat is your main programming language; in which you do most of the work?
- frozenport 12y agoCompilers are increasingly optimizing out UB, recently fixed a problem where `std::unique_lock` was optimized as it was referenced from an `std::thread` defined at the top of the class. The future is now!
- gamegoblin 12y agoMy CS101 prof would give 50-100 line blocks of code, and hidden in them somewhere would be something like: if(condition); { some stuff } Note the semicolon after the if-statement. The tests became games of "find the semicolon or = in place of ==". Ugh.
- oneeyedpigeon 12y agoThankfully, your compiler probably warns about this nowadays, making such pointlessness obsolete.
- ygra 12y agoAnd the static analysis tool you're hopefully using.
- rtpg 12y agoonly useless if you never make a mistake ever. This shows what you should be vigilant for (alternatively , an argument for using a language with more checks) As someone on HN once said (in jest), it's easy to write bug-free C, you just need to never make a mistake ever and spend a million hours auditing it.
- icebraining 12y agoIf those mistakes are so teachable, wouldn't it be better to put them into a linter?
- joosters 12y agoThey are in linters, and many of them will be thrown up as warnings by the compiler in the first place.
- cbsmith 12y agoA lot of these are cases where I've seen actual bugs. Popular ones are >= 0 checks, dumb assumptions about overflows and null derefs, and the always popular "use an int when it should be size_t".
- deleted 12y ago[deleted]