MESSAGE
DATE | 2010-02-05 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] C++ Workshop I datatypes cont..
|
References:
References in general programming, is a symbolic variable that points to a data structure which is addressed by another symbolic variable, and has some syntax in order to allow the reference to act like the original variable. But references don't directly store the original data structure, just the needed instructions to go find the data in RAM.
All programming languages need to keep track of the symbols in it running program, and the addresses that the symbols are associated with, in order to retrieve data from those addresses. In Perl, the language has such a symbols table built into its runtime environment. Easy direct access to entries in the look up table is a key reason why Perl is such a flexible and simple language.
In C programming there are no references (although it has a look up table as was shown in the first entry of this workshop using nm on a C binary). There are, however, pointers, which store RAM addresses and allow indirect access to data structures. C++ adds a formal reference, although it is not a very flexible reference syntactically. In C++, if you create a symbolic variable of some data type which is assigned data, you can create a reference to that variable which acts just like the variable itself. But like a pointer, a reference stores an address, not the data. And in that regard, it's syntax is difference. And we'll see that soon. References in C++ are also called Aliases. A reference creates an alias to an existing variable. A reference cannot be created without assigning it to an existing data structure.
Functions or Methods: Functions are a symbolic variable that store code. Code is a data type, although you'll rarely hear it discussed as such. The most important function in Unix and C++ is main(). All programs must have main(). Functions are stored in RAM and pointers can point at them by storing that address.
OK Done with Data Types. Next we start with Data Creation and syntax. First we will discuss data creating and storage syntax, and then afterwards we will take a formal look at general C++ syntax rules, Keywords, and built in operators.
|
|