title: How to use a C assert to make the code more secure?
body: <p>Reading misc. tutorials related to SDL development I've found two different examples, doing the same thing, but in a different manner. I was wondering which of the two are you considering to be correct, judging from the perspective of code "security" and maintainability .</p>
  
  <p>In the first example the programmer isn't using assert at all, but the code looks OK (at least for my eye):</p>
  
  <pre><code>int main(){
          SDL_Surface *screen;
  
          /** Initialize SDL */
          if(SDL_Init(SDL_INIT_VIDEO)!=0){
                  fprintf(stderr,"Unable to initialize SDL: %s",SDL_GetError());
          }
          atexit(SDL_Quit);
  
          /** Sets video mode */
          screen=SDL_SetVideoMode(640,480,16,SDL_HWSURFACE);
          if(screen==NULL){
                  fprintf(stderr,"Unable to set video mode: %s",SDL_GetError());
          }
  
          return (0);
  }
  </code></pre>
  
  <p>In the second example the programmer [other] is using a different approach, something like (the code isn't exactly copy-paste):</p>
  
  <pre><code>int main(){
          SDL_Surface* screen;
  
          /** Initialize SDL */
          assert(SDL_Init(SDL_INIT_VIDEO)==0);
          atexit(SDL_Quit);
  
          /** Sets video mode */
          screen=SDL_SetVideoMode(640,480,16,SDL_HWSURFACE);
          assert(screen!=NULL);
  
          return (0);
  }
  </code></pre>
  
  <p>Is it OK to "substitute" in the if conditions (from the first example) with asserts like in the second example ?</p>
  
  <p>What's the right strategy (if there's any) ?</p>