|
|
John VanSickle wrote:
> This convention rests on adding a lower-case letter to the start of all
> variable names, except for objects, and for including at least one
> upper-case letter after this point, to avoid conflicts with the reserved
> words in the POV-Ray scripting language.
Good idea. I've been using a variation on it for a few months now.
Of course, I extended it to everything I could think of that could
be #declared. (And then lost the file I kept it in to a backup
error and had to rebuild it so it probably isn't complete anymore),
but I have found it useful indeed and have been trying lately to
force myself to remember. The rules I use are 2-4 letter prefix,
followed by a mnemonically helpful name. Prefix in lower case, each
word of name capitalized. You're right, it is quite helpful in
preventing name clashes and identifying variable types. Not 100%
effective in the name clash thing, but usually you can get around
the problems that still exist by suffixing the variable name with
a letter or digit to distinquish different "components" of the same
object.
I never thought of distinguishing between floats and, for example,
integer looping variables, or booleans, or different kinds of
vectors (all floats are "fv-" and all vectors are "vec-" in my
code) but considering half the point is to identify the use of the
variable, that's not a bad idea, really.
Post a reply to this message
|
|