Defining Programming Standards   
for Professional Programmers 
  

         

Home

Contents

1: Standards

2: Psychological Factors

3: General Principles

4: Commenting

5: Naming

6: Code Layout

7: File Layout

8: Language Usage

9: Data Usage

10: Programming Usage

11: Implementing Standards

A: Example Standard

B: References

C: Glossary

Syque

About

Share this page:

Google
C Style
syque.com
Web

 

 

Books and
more at:

USA:

In association with amazon.com

UK:

In Association with Amazon.co.uk

Canada:

In Association with amazon.ca

 

 

CHAPTER 5 : Naming

PART 2 : COMMENTING AND NAMING

CHAPTER 5 : Naming
5.1 Constraints upon naming
5.2 Abbreviations
5.3 Short names
5.4 Separating words
5.5 Spelling of names
5.6 Naming functions
5.7 Indicating functional group
5.8 Naming variables
5.9 Indicating type
5.10 Naming replacement items
5.11 Naming Files and Directories
5.12 Summary

<--Prev page | Next page -->

 

5.11  Naming Files and Directories

Files, and the directories that hold those files can use a similar naming convention to variables to describe the functions or files that they contain. They are often more constrained in length than C identifiers, consequently requiring the more severe use of abbreviations.

5.11.1  Naming files

Files are can often be named using a functional grouping prefix, reflecting the subsystem they belong to and the action of the functions that they contain:

 

winopn, winmov, kbdread, kbdinit

 

Using the same or similar names to system files (such as stdie.h) should be avoided.

Suffixes

It is common to use a suffix (or 'extension') to describe the type of file - indeed, it is expected by some compilers. The basic subset is '.c' for C source files and '.h' for an included header file. All suffixes should be documented, including reserved system suffixes, such as '.o' for object files, '.y' for 'yacc' files, etc.

For maximum portability, file names should start with an alphabetic character, be alphanumeric, have 8 characters or less in the main name, with no more that three characters in the suffix.

5.11.2  Naming directories

Directory structures are like nested C 'struct's, and can be named in a similar manner.

 

/windows/source/iconize/

 

In this scheme, 'windows' contains all files for the windowing system, 'source' contains all source files, and 'iconize' contains source files for the iconizing functions.

 

<--Prev page | Next page -->

 

 

  © Syque 1995-2010

Massive Content -- Maximum Speed