Skip to content

Improve handling of strerror messages #9

Description

@JayFoxRox

(This is a low priority issue, but ports would probably require updates, so it's good to fix this before a bad implementation propagates)

As also indicated by the comment, this function is not ideal:

/* TODO: Doing this via a static array is not the way to do it. */
char * strerror( int errnum )
{
if ( errnum >= _PDCLIB_ERRNO_MAX || errnum < 0 )
{
return _PDCLIB_EUNKNOWN_TEXT;
}
else
{
return _PDCLIB_lc_messages.errno_texts[errnum];
}
}

We actually discussed this briefly downstream in this conversation:

  • We have fairly large gaps in our error numbers / strings (so an array is not ideal).
  • There is some ambiguity wether the error message is "unknown error" from the host OS, or if it is "unknown error" from the pdclib error_readout tool.
  • There is no way to implement custom "unknown error"-messages algorithmically (for including the error number for example).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions