Misuse of extensions

File extension is used to show the type of the file. In another words, it tells which program eats the file. So the following examples are all bad.


  • patchfile-hogehoge
  • script-hogehoge.txt
  • Make.Rules
  • linker.ld

They should be like this:


  • hogehoge.patch
  • hogehoge.sh
  • Rules.mk
  • hogehoge.ld

People sometimes uses extension for other reasons. Don’t do this:


  • read.me
  • a.out
  • hello.c.20091225

Even if you mess up extensions from time to time, that doesn’t bite you soon. But you might get bitten later, or some other people get bitten. For example, Emacs looks at extension to decides it’s mode. If you rename a file like “hello.c.20091225”, Emacs cannot decide the mode. “hello-20091225.c” is the right way.

For UNIX people, executable file often do not have extension, such as just “hello”. However I have seen .x extension used by some GNU guru; for example, “hello.x”. This is sometimes good idea when you want to automate the complex build process. Plus, you can clean up the executable files with just

    $ /bin/rm *.x

By the way, I have also seen some people using .elf extension for the same reason. That is silly because .o files are also in ELF format.