<head><title>ColdC: Objects: Referencing Objects</title></head> <body> <h1 align=center><a href="/ColdC/">ColdC</a>: <a href="/ColdC/Objects/">Objects</a>: Referencing Objects</h1> <hr> <p>Each object has an <i>Object Number</i> (<i>objnum</i>), which is a unique number assigned to that object upon its creation. <I>Object numbers</i> cannot be changed after an object is created. When an object is destroyed, it's <i>objnum</i> is not re-used by the driver.</p> <p>In ColdC an object number is designated with a hash mark ('#') follwed by the object's number. For instance <code>#23</code> refers to <i>object number</i> <code>23</code>.</p> <p>An object can also have an <i>Object Name</i> assigned to it, which can be changed througout the life of the object. Object Name's are only unique to that object, while the object has the name. Once the name is changed the old name can be taken by another object. Object Names exist for practical functionality. It is easier to remember references which consist of alphabetic and numeric characters, compared to references which are simply numeric. <p>When the driver attempts to print out a reference to an object, the Object Name will take precedence over an Object Number, because the name is generally easier to remember and comprehend. Object Name's are composed of alphabetic characters, numbers, and the underscore character ('_'). In ColdC an object number is designated with a dollar sign ('$'), followed by the name. For instance, if the object <code>#23</code> had the name <i>object_23</i> assigned to it. It would be formatted in ColdC as <code>$object_23</code>.</p> <p>When the interpreter encounters an object name, it looks up the number associated with that name in a table. If no object has been assigned to that name, a <code>~namenf</code> error is thrown; otherwise the object name is equivalent to the object number.</p> <dl> <dt><b>ColdC Functions</b> <dd><a href="/ColdC/Functions/Object.html#set_objname">set_objname()</a>, <a href="/ColdC/Functions/Object.html#del_objname">del_objname()</a>, <a href="/ColdC/Functions/Object.html#objname">objname()</a>, <a href="/ColdC/Functions/Object.html#objnum">objnum()</a>, <a href="/ColdC/Functions/Object.html#lookup">lookup()</a>. </dl> <hr size=4><p align=center><i>Last Modified on Mar 2 1996</i> <br><i>Copyright © 1995, 1996, Brandon Gillespie</i> </body>