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
  • acosh
  • asin
  • asinf
  • asinh
  • atan
  • atan2
  • atan2f
  • atanf
  • atanh
  • cbrt
  • cbrtf
  • ceil
  • ceilf
  • cos
  • cosf
  • cosh
  • div
  • erf
  • erff
  • exp
  • expf
  • exp2
  • exp2f
  • fabs
  • fabsf
  • floor
  • floorf
  • fmaf
  • fmod
  • fmodf
  • frexp
  • ilogbf
  • isfinite
  • isnan
  • labs
  • llround
  • llroundf
  • log
  • log10
  • log10f
  • log2
  • log2f
  • ldexp
  • lrint
  • lrintf
  • modf
  • nearbyint
  • nearbyintf
  • nextafter
  • nextafterf
  • pow
  • powf
  • remainder
  • round
  • roundf
  • scalbn
  • sin
  • sinf
  • sinh
  • sqrt
  • sqrtf
  • tan
  • tanf
  • tanh
  • trunc
  • truncf

<stdio.h>

  • sscanf
  • vsscanf

<stdlib.h>

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

<string.h>

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

<tgmath.h>

  • ceill
  • logl

<wchar.h>

  • wcscat
  • wcschr
  • wcslen
  • wmemchr
  • wmemcmp
  • wmemcpy
  • wmemmove
  • wmemset
  • wcsncmp
  • snprintf
  • sprintf
  • vfwprintf
  • vsnprintf
  • vswprintf
  • ferror
  • fputwc
  • fwide