1
$\begingroup$

What is the equivalent for C++'s using namespace ...; in SymbolicC package of mathematica and are there any good resources like video tutorial or lecture or books covering this package?

$\endgroup$
3
$\begingroup$

Have you looked at the builtin documentation?

The introduction – C++ section clearly states:

At present, SymbolicC only supports C syntax.

That is, it does not support C++.


SymbolicC doesn't really do a lot. It just makes code generation slightly easier than joining strings together, as it can convert some expressions (e.g. arithmetic expressions) automatically.

You could extend SymbolicC for your own use, but before you try to do so, think about why you want to do this. What are you hoping to gain? I have added some minor extensions to it in my LTemplate package to handle C++ specific things like try/catch. But later I realized that most of this was not necessary, as it provides little tangible benefit over simply using strings. The only extension that was truly useful is CInlineCode (see my code), which I used to prevent SymbolicC from adding semicolons in inconvenient places.

If you really want to extend SymbolicC, take a look at its source code, as well as my code. Most things can be done by adding extra definitions to GenerateCode and SymbolicC`Private`IsCExpression.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.