MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
MaxMatrixAttributes.h File Reference

The attributes of a later standard, as macros, where the compiler has them. More...

Go to the source code of this file.

Macros

#define MAXMATRIX_NODISCARD   __attribute__((warn_unused_result))
 Marks a function whose result must not be dropped: the compiler warns where it is.

Functions

template<typename Value>
void max_matrix::Discard (Value const &)
 Drops a result marked with MAXMATRIX_NODISCARD on purpose, with the reason in a comment beside the call.

Detailed Description

The attributes of a later standard, as macros, where the compiler has them.

Macro Definition Documentation

◆ MAXMATRIX_NODISCARD

#define MAXMATRIX_NODISCARD   __attribute__((warn_unused_result))

Marks a function whose result must not be dropped: the compiler warns where it is.

[[nodiscard]] where the compiler has it, GCC's warn_unused_result otherwise. The library marks a getter's result, whose value would be lost, and the results the parts below Matrix pass on; not a setter's Status, which a sketch may drop when it has no one to tell.

Function Documentation

◆ Discard()

template<typename Value>
void max_matrix::Discard ( Value const & )

Drops a result marked with MAXMATRIX_NODISCARD on purpose, with the reason in a comment beside the call.

Rather than a cast to void: where the macro is warn_unused_result, GCC warns through a cast, clang does not, so a cast that passes on the host could fail the build for the board.

Template Parameters
ValueThe type of the result.