const char *cnc_mcerr_to_str(cnc_mcerr __err)

Returns a string representing the error code’s name.

enumerator cnc_mcerr_ok

Returned when processing of the input and writing of the output is successful and nothing has gone wrong.

enumerator cnc_mcerr_incomplete_input

Returned when there is not yet an error in processing the input, but the input is exhausted before a proper single unit of work is complete.


It is fundamentally important that this is returned from conversion routines when the input is fully exhausted AND the input sequence of bytes/code units/code points is not erroneous. If the input values are erroneous, cnc_mcerr_invalid_sequence should be used instead.

enumerator cnc_mcerr_invalid_sequence

Returned when there is an error processing any input. No output is written.


This can only be applied when processing the input finds an invalid sequence or an improper input value. It shall not be used for exhausted input or empty input. Critically, no output from that specific unit of work is written (but any previously written successful output remains with e.g. any bulk conversion function).

enumerator cnc_mcerr_insufficient_output

Returned when the size of the output is not sufficiently large to handle the value of the error.


For single functions (functions that complete only a single unit of work), cnc_mcerr_insufficient_output can be entirely avoided by providing a large enough statically sized buffer. This is typically done by using the maximum-output macros such as CNC_C32_MAX - see the documentation for more details.