There are several "extensions" of the C/C++ language available in CSS.
The most obvious one is the ability to shorten the path to refer to a
particular hard-coded object by skipping those elements that are the
first of a given group. Thus, if referring to a unit in the first layer
of a network, in the first project, one can say: .units[x]
instead of .projects[0].networks[0].layers[0].units[x]
.
Also, one can often avoid the use of a type specifier when initializing a new variable, because CSS can figure out the type of the variable from the type of the initializing expression:
var1 = "a string initializer"; // type is inferred from initializer // instead of String var2 = "a string initializer"; // instead of explicitly declared
When referring to a hard-coded type, CSS will automatically use the
actual type of the object if the object derives from the ta_Base
class which is aware of its own type information.
CSS does not pay attention to the distinction between ptr->mbr
and obj.mbr
. It knows if the object in question is an object
itself or a pointer to an object, and can figure out how to access the
members appropriately.
All of the basic CSS types (see section 7.4.5 Basic Types in CSS) know how to convert themselves into the other types automatically, without even casting them. However, you can use an explicit cast if you want the code to compile properly in standard C/C++.
Also, all script variables for hard-coded objects are implicitly
pointers, even if not declared as such. This is because script objects
are not the same thing as hard-coded ones, and can only act at best as
reference variables for them (i.e., essentially as pointers, but you can
use the obj.mbr
notation, see previous paragraph). Thus, while
you can write CSS code that would also compile as C++ code by using
ptr->mbr
notation to refer to hard-coded objects, you can also
cheat and use the simpler obj.mbr
notation even when obj
is a pointer.