| Ravi Welcome Documentation Documentation About Ravi Documentation Introduction Premiers pas avec Ravi ravitool Scheme Tutorial Objets Scheme Le shell ravi Starting Ravi Le module trace Les ports d'E/S The C Parser load, require, modules Système d'interruptions Scheme compiler C++ mode Generating C++ Modules La déclaration struct Le type "C-object" More information Installation | C++ modeC++ mode makes the Ravi shell act as a C++ interpreter. The interpreter reads a "command" which must be a single C/C++ instruction, executes it, and prints the result. Let's look at a simple session of ravi in C++ mode: This example uses the modpoint module presented in module generation
Short noticeUsefull ways to activate C++ mode
Switching between C++ mode and Lisp modeThe command scheme switches from C== to Lisp/Scheme. The function (c++-toplevel) switches from Scheme to C++.
In order to simplify interactive use, c++ mode accepts a modified C++ syntax.
This is very practical - the follwing 3 lines are strictly equivalent:
Under C++ mode you have access to all parts of the Ravi environment, which includes (actually, it initially IS) a complete Scheme system. This has an annoying consequence: in Scheme, the hyphen (minus sign) is traditionnally used to separate the syllables of a symbol, rather than the underscore character used in C. This means Scheme identifiers are not legal identifiers in C. For this reason, the minus sign in C++ mode has the special property of being considered a letter if it follows a letter or digit. This can be annoying inside arithmetic expressions. You can give the - sign its "pure C" syntax ... Using Scheme functions in C++ mode
|