* better
[mascara-docs.git] / lang / C / the.ansi.c.programming.language / notes.accompany.ansi.c / sx5a.html
blob7f7c0646ddf60b4e5434265773d319f273b05819
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. -->
5 <html>
6 <head>
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>
13 </head>
14 <body>
15 <H2>section 2.1: Variable Names</H2>
17 <p>Deep sentence:
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
21 (is the same as)
22 a name already chosen by a library routine,
23 either your code
24 or the library routine
25 (or both)
26 won't work.
27 Naming issues become very significant in large projects,
28 and problems can be avoided by setting guidelines for who may
29 use which names.
30 One of these guidelines is simply that user code should not use
31 names beginning with an underscore,
32 because these names are
33 (for the most part)
34 ``reserved to the implementation''
35 (that is,
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
42 symbolic constants
43 (i.e. as
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.
51 </p><p>Deep sentence:
52 <blockquote>Keywords like
53 <TT>if</TT>, <TT>else</TT>, <TT>int</TT>, <TT>float</TT>, etc.,
54 are reserved;
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.
58 </p><hr>
59 <p>
60 Read sequentially:
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>
65 </p>
66 <p>
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>
70 </p>
71 </body>
72 </html>