Next: , Previous: GH preliminaries, Up: GH


5.22.4 Data types and constants defined by GH

The following C constants and data types are defined in gh:

SCM is a C data type used to store all Scheme data, no matter what the Scheme type. Values are converted between C data types and the SCM type with utility functions described below (see Converting data between C and Scheme). [FIXME: put in references to Jim's essay and so forth.]

— Constant: SCM_BOOL_T
— Constant: SCM_BOOL_F

The Scheme values returned by many boolean procedures in libguile.

This can cause confusion because they are different from 0 and 1. In testing a boolean function in libguile programming, you must always make sure that you check the spec: gh_ and scm_ functions will usually return SCM_BOOL_T and SCM_BOOL_F, but other C functions usually can be tested against 0 and 1, so programmers' fingers tend to just type if (boolean_function()) { ... }

— Constant: SCM_UNSPECIFIED

This is a SCM value that is not the same as any legal Scheme value. It is the value that a Scheme function returns when its specification says that its return value is unspecified.

— Constant: SCM_UNDEFINED

This is another SCM value that is not the same as any legal Scheme value. It is the value used to mark variables that do not yet have a value, and it is also used in C to terminate functions with variable numbers of arguments, such as gh_list().