Table of Contents

 
SDLFailed
 

Purpose

Tests return value from SDL function call and returns true or false

 

Protoype

bool CError::SDLFailed (int i_value)
 

Parameters

value the return value of an SDL function
 

Description

This function can be used to properly decipher the return value of SDL functions. Since SDL return values are 0 for True and -1 for False, it doesn't make for a clean IF test, and it can also be just plain confusing. This function is inlined to make its usage worthwhile.

NOTE: as obvious as it may be I will repeat - this function should be used only on base-level SDL functions (not any framework functions that use SDL functions)

 

Use

CError error;
if (error.SDLFailed(SDL_BlitSurface(ps_surface1, NULL, ps_surface2, NULL)))
    // houston, we have a problem!
 

Prev: OpenLog
Next: SetFilter