Click or drag to resize

CheckForNull Macro

Returns from the current function with an error ViStatus if any of the supplied pointer arguments are null.

#define CheckForNull(Vi, ...)
Parameters
Vi

[in] ViSession handle for the driver session.

... (variable argument list)

[in] Comma-separated list of pointer variables to test against null.

Remarks

This macro is used to validate pointer arguments. If any of the arguments are null, then this macro will return from the current function with a ViStatus value of IVIC_ERROR_NULL_POINTER. Before returning, this function stores the error code and appropriately formatted error message in the driver session so that client code may retrieve both via the GetError function.

Example

The following example demonstrates use of the CheckForNull macro.

C++
ViStatus _VI_FUNC acme4321_ReadData(ViSession Vi, ViReal64* Frequency, ViReal64* Amplitude)
{
    ValidateSession(Vi);
      ObtainLock(Vi);
      CheckForNull(Vi, Frequency, Amplitude);

    // ...
}

Download a complete CHM version of this documentation here.