Node:Data types and constants defined by gh, Next:, Previous:gh preliminaries, Up:GH



19.3 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.]

SCM_BOOL_T Constant
SCM_BOOL_F Constant
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()) { ... }

SCM_UNSPECIFIED Constant
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.

SCM_UNDEFINED Constant
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().