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>

  • acos
  • acosf
  • asin
  • asinf
  • atan
  • atan2
  • atan2f
  • atanf
  • cbrt
  • cbrtf
  • ceil
  • ceilf
  • cos
  • cosf
  • div
  • erf
  • erff
  • exp
  • expf
  • exp2f
  • fabs
  • floor
  • floorf
  • fmod
  • fmodf
  • frexp
  • isfinite
  • isnan
  • labs
  • llround
  • llroundf
  • log
  • log10
  • log10f
  • log2
  • log2f
  • ldexp
  • lrint
  • lrintf
  • modf
  • nearbyint
  • nearbyintf
  • nextafter
  • nextafterf
  • pow
  • powf
  • round
  • roundf
  • scalbn
  • sin
  • sinf
  • sqrt
  • sqrtf
  • tan
  • tanf
  • trunc
  • truncf

<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

<tgmath.h>

  • ceill
  • logl

<wchar.h>

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