New in Wolfram
Mathematica
8: SymbolicC
◄
previous
|
next
►
Software Development
Writing Programs That Write Programs
Writing programs that write other programs, also called "metaprogramming", is a useful technique in generating specialized and optimized code.
In[1]:=
X
Needs["SymbolicC`"] addTwo[type_] := CFunction[type, "addTwo_" <> type, {{type, arg}}, CReturn[COperator[Plus, {arg, 2}]]] ToCCodeString[addTwo /@ {"char", "short", "int", "float", "double"}]
Out[1]=