Node: To C++ Primitive Types, Previous: From C++ Primitive Types, Up: Conversions



To C++ Primitive Types

Converting an Lpp object back to primitive C types is done with the xL converter, where x designates a primitive C type.

iL x Function

cL x Function

sL x Function

pL x Macro

The function iL converts an Lpp Integer x to and int and returns, cL converts an Lpp Character x to a char and returns, sL converts an Lpp String x to a char* string and returns, pL converts an Lpp predicate (nil or t) to a C predicate (0 or 1). Some examples are:

     // Converting a ...
     let myInteger = L(5);              // C integer to Lpp Integer
     int i1 = iL(myInteger);            // Then back to int
     let c1 = L('z' );                  // C char to Lpp character
     char ch = cL(c1 );                 // Then back to C char
     let myString = L("Some string");   // C string to Lpp string
     char* s1 = sL(myString);           // Then back to a char*