1 <!DOCTYPE HTML PUBLIC
"-//W3O//DTD W3 HTML 2.0//EN">
2 <!-- This collection of hypertext pages is Copyright 1995, 1996 by Steve Summit. -->
3 <!-- This material may be freely redistributed and used -->
4 <!-- but may not be republished or sold without permission. -->
7 <link rev=
"owner" href=
"mailto:scs@eskimo.com">
8 <link rev=
"made" href=
"mailto:scs@eskimo.com">
9 <title>section
2.1: Variable Names
</title>
10 <link href=
"sx5.html" rev=precedes
>
11 <link href=
"sx5b.html" rel=precedes
>
12 <link href=
"sx5.html" rev=subdocument
>
15 <H2>section
2.1: Variable Names
</H2>
18 <blockquote>Don't begin variable names with underscore, however,
19 since library routines often use such names.
20 </blockquote>If you happen to pick a name which ``collides'' with
22 a name already chosen by a library routine,
24 or the library routine
27 Naming issues become very significant in large projects,
28 and problems can be avoided by setting guidelines for who may
30 One of these guidelines is simply that user code should not use
31 names beginning with an underscore,
32 because these names are
34 ``reserved to the implementation''
36 reserved for use by the compiler and the standard library).
37 </p><p>Note that case is significant;
38 assuming that case is ignored
39 (as it is with some other programming languages and operating systems)
40 can lead to real frustration.
41 </p><p>The convention that all-upper-case names are used for
44 created with the
<TT>#define
</TT> directive,
45 which we learned about in section
1.4)
46 is arbitrary, but useful.
47 Like the various conventions for code layout (page
10),
48 this convention is a good one to accept
49 (i.e. not get too creative about),
50 until you have some very good reason for altering it.
52 <blockquote>Keywords like
53 <TT>if
</TT>,
<TT>else
</TT>,
<TT>int
</TT>,
<TT>float
</TT>, etc.,
55 you can't use them as variable names.
56 </blockquote>You can find the complete list of keywords
57 in appendix A2.4 on page
192.
61 <a href=
"sx5.html" rev=precedes
>prev
</a>
62 <a href=
"sx5b.html" rel=precedes
>next
</a>
63 <a href=
"sx5.html" rev=subdocument
>up
</a>
64 <a href=
"top.html">top
</a>
67 This page by
<a href=
"http://www.eskimo.com/~scs/">Steve Summit
</a>
68 //
<a href=
"copyright.html">Copyright
</a> 1995,
1996
69 //
<a href=
"mailto:scs@eskimo.com">mail feedback
</a>