9
Gophyr
7d

Yesterday was the first day of an "Advanced" C programming class. I looked at the first homework afterwards and saw this:

NEVER use 'assert'. Real programmers don't use assert in big software projects because it makes your code stop.

Who the... What... How... Why would you...

*sigh* it's going to be a long two months.

Comments
  • 0
    *Me, trying to save this in any way if possible*

    I think what it might wanted to explain (and failed horribly), is that assertions should be used only in development environment and not in production code.
  • 0
    Normally assert is a no-op in a release build, unless the macro is redefined.
  • 0
    @antorqs there are some cases where you're always going to want assert. If you have a 10 or 100 thousand line project, assert is very useful in making sure all of the different parts work together properly, etc.
  • 0
    @Gophyr Yeah, but again, in development code.

    What I mean is: you don't rely on assertions as conditions in production code.
  • 0
    UNIT TESTING baby!
  • 0
    Omg "makes the code stop"

    I suddenly don't remember the exact words; I saw it 30 seconds ago. Brain, you good?
Your Job Suck?
Get a Better Job
Add Comment