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

From C++ Primitive Types

In Lpp the L macro is used for converting any basic C type to an Lpp object.

L x Macro

This macro returns an Lpp object that is analogous to the type of the argument x. For example if x is a int then an Lpp Integer object is returned. Note that no part of the returned Lpp object shares the value of x. Some actual examples are:

     // Converting a ...
     let myInteger = L(5);             // C integer to Lpp Integer
     int x = 123;
     let myInteger2 = L(x)             // C integer to Lpp Integer
     let myCharacter = L('z')          // C char to Lpp Character
     let myString = L("Some string");  // C string to Lpp string
     let myFun = L(cFunction);         // C function to Lpp function

The Lpp object types created by the L conversion macro when applied to C++ types is as follows:

     int => Lpp Integer
     char => Lpp Character
     char* => Lpp String
     let fun(let, let ...) =>  Lpp Function

An Lpp Function object can be created from a function returning a type let taking 0 or more type let arguments.