Starboard and C99

Background

Historically Starboard did not allow usage of standard C symbols in order to isolate Cobalt from non-compliant libc implementations and to provide a single, consistent behavior at the Starboard API layer.

C99 Usage Rationale

  1. Inconsistencies in the libc libraries are rare and all third party libraries need to be ported to the Starboard API. This can be a significant maintenance cost as the dependencies need to be periodically rebased.

  2. Even with all the efforts to use POEM headers from the starboard/client_porting directory many non-Evergreen platforms still have a lot of direct system dependencies. These dependencies do not exist for Evergreen platforms as Cobalt is statically linked with the musl libc library.

  3. Starting with Starboard 13 a limited set of C99 symbols will be allowed. This set will expand gradually while the corresponding Starboard APIs will be deprecated and eventually removed.

List of Allowed C99 Symbols

<ctype.h>

  • isalnum
  • isdigit
  • isspace
  • isupper
  • isxdigit
  • tolower
  • toupper

<math.h>

  • fabs
  • floor
  • isfinite
  • isnan
  • pow
  • sqrt
  • sqrtf

<stdlib.h>

  • abs
  • atoi
  • atol
  • bsearch
  • strtof
  • strtod
  • strtol
  • strtoll
  • strtoul
  • strtoull
  • qsort

<string.h>

  • memchr
  • memcmp
  • memcpy
  • memmove
  • memset
  • strcat
  • strchr
  • strcmp
  • strcspn
  • strlen
  • strncmp
  • strncat
  • strrchr
  • strstr
  • strspn

<wchar.h>

  • wcscat
  • wcschr
  • wcslen
  • wmemchr
  • wmemcmp
  • wmemcpy
  • wmemmove
  • wmemset
  • wcsncmp