Hacker Newsnew | comments | show | ask | jobs | submit login

> this comment is also scary from the C family of languages background:

> "When using assert properly, this is a feature, but when assert is > used inappropriately, it leads to code that is completely broken when running with the -O flag."

That's more or less how all compiled languages work - it's not a bug, nor is it scary. Developers want things their users don't, like assertion calls, debug symbols and additional type/bounds checking and whathave you; things that, while helpful to a developer, would only slow down the program by requiring greater amounts of CPU and ram to run. That's why these things are compiled out of "release" builds.

Yes, this can introduce very rare and subtle bugs, and not just from people making assertion calls with side effects -- but also from additional belt-and-braces checks placed by the compiler in the dev build.




i think you misunderstand me, what is scary is that the comment needs making at all.

"why don't people test their software by merely running it? esp in the config it will ship in."

i.e. why aren't you testing what you ship. i.e. with the -O flag on. the fact that build flags cause headaches like this is well understood from my history with languages using the C preprocessor - all C, C++ etc. programmers will have a good handle on this from necessity i think. it scares me to think that people are writing code but not understanding what it is going to do...

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: