N 2576: Character handling for freestanding implementations

Submitter:Philipp Klaus Krause
Submission Date:2020-09-30

Summary:

Character handling for freestanding implementations.

This makes the ctype.h features mandatory for freestanding implementations.

Justification:

Character classification is a commonly needed functionality; if, as common for freestanding implementation, only the C locale is supported, such functionality is easily implemented. However, since ctype.h is not mandatory for freestanding implementtions, programs using them are not fully portable, so embedded systems programmers tend to reimplement their own requivalents of the function in ctype.h

The Small Device C Compiler (SDCC) is a rather simple freestanding C implementation, that targets small devices, such as the Padauk PMS15A microcontroller (about 0.01€ each when bought in quantities of 10, 64 B RAM, 0.5 KW of 13-bit program memory, an 8-bit accumulator as the only register suitable for storing general data). It implements the full set of ctype.h functions from the N2479 draft. This shows that the ctype.h functions can easily be implemented efficiently even for tiny devices.

Do we want to make ctype.h mandatory for freestanding implementations?

Proposed change: §4p6: Add "ctype.h" to the list of headers freestanding implementations need to provide (4p6 in N2479).