hdo  beta
Definice maker
Dokumentace souboru /home/mrazik/Documents/web/old/hdo/at91lib/utility/assert.h
#include <stdio.h>
#include "trace.h"

Zobrazit zdrojový text tohoto souboru.

Definice maker

#define ASSERT(condition,...)
#define SANITY_ERROR   "Sanity check failed at %s:%d\n\r"
#define SANITY_CHECK(condition)   ASSERT(condition, SANITY_ERROR, __FILE__, __LINE__)

Detailní popis

Purpose

Definition of the ASSERT() and SANITY_CHECK() macros, which are used for runtime condition & parameter verifying.

Usage

  1. Use ASSERT() in your code to check the value of function parameters, return values, etc. *Warning:* the ASSERT() condition must not have any side-effect; otherwise, the program may not work properly anymore when assertions are disabled.
  2. Use SANITY_CHECK() to perform checks with a default error message (outputs the file and line number where the error occured). This reduces memory overhead caused by assertion error strings.
  3. Initialize the dbgu to see failed assertions at run-time.
  4. Assertions can be entirely disabled by defining the NOASSERT symbol at compilation time.

Definice v souboru assert.h.


Dokumentace k definicím maker

#define ASSERT (   condition,
  ... 
)
Hodnota:
{ \
            if (!(condition)) { \
                printf("-F- ASSERT: "); \
                printf(__VA_ARGS__); \
                while (1); \
            } \
        }

Checks that the given condition is true, otherwise displays an error message and stops the program execution.

Parametry:
conditionCondition to verify.

Definice je uvedena na řádku 88 v souboru assert.h.

Používá se v ADC_DisableChannel(), ADC_DisableIt(), ADC_EnableChannel(), ADC_EnableIt(), ADC_GetConvertedData() a ADC_Initialize().

#define SANITY_CHECK (   condition)    ASSERT(condition, SANITY_ERROR, __FILE__, __LINE__)

Performs the same duty as the ASSERT() macro, except a default error message is output if the condition is false.

Parametry:
conditionCondition to verify.

Definice je uvedena na řádku 100 v souboru assert.h.