Open Search
    Error Utility

    Table of Contents

    Macros

    These macros are used to automatically check the given condition and to return an error object if the condition is not met:

    See also Error Types.

    // This function checks the given arguments and returns an error if they do not match.
    //----------------------------------------------------------------------------------------
    // This functions adds the values stored in the second array to the values stored in the first array.
    // Both arrays must have the same size.
    // @param[in, out] arrayA The first array. It will contain the result values.
    // @param[in] arrayB The second array.
    // @return maxon::OK on success.
    //----------------------------------------------------------------------------------------
    {
    // check arguments
    CheckArgument(arrayA.GetCount() == arrayB.GetCount(), "Array sizes do not match.");
    // add numbers
    const maxon::Int size = arrayA.GetCount();
    for (maxon::Int i = 0; i < size; ++i)
    arrayA[i] = arrayA[i] + arrayB[i];
    return maxon::OK;
    }
    Py_ssize_t i
    Definition: abstract.h:645
    Definition: basearray.h:414
    MAXON_ATTRIBUTE_FORCE_INLINE Int GetCount() const
    Gets the number of array elements.
    Definition: basearray.h:584
    Py_ssize_t size
    Definition: bytesobject.h:86
    Int64 Int
    signed 32/64 bit int, size depends on the platform
    Definition: apibase.h:187
    return OK
    Definition: apibase.h:2771
    #define CheckArgument(condition,...)
    Definition: errorbase.h:486
    #define iferr_scope
    Definition: resultbase.h:1396

    Further Reading