How we change what others think, feel, believe and do

| Menu | Quick | Books | Share | Search | Settings |

C Style: Standards and Guidelines (contents)

CHAPTER 5 : 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.


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.




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 -->


Site Menu

| Home | Top | Settings |

Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive |

And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact |

Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate |


You can buy books here

More Kindle books:

And the big
paperback book

Look inside


Please help and share:


| Home | Top | Menu |

© Changing Works 2002-
Massive Content -- Maximum Speed