Broken Hungarian Notation

last modified: December 11, 2007

This is something rather insane that I use.

I have rather adapted an unusual naming convention based on HungarianNotation. More specific entries are further down, pick last matching rule.

* Private (and sometimes protected) member variables start with _.
* Stack references get prefix o: oRow, oFactory, oConnection, etc.
* Handles to objects (or objects that wrap such handles) get single letter prefixes:
  * f for file objects
  * s for sockets
  * h for other random objects (including nonspecific IO handles)
* Handles to GUI objects get a three letter type identifier: txt, cmb, cmd, tv, frm, etc.
* pointers (except object pointers) usually start with p.
  * Looping pointers are ptr or derived from ptr.
* Trivially named objects get single or two letter starting with certain letters:
  * i, j, k: unspecified integer, often loop counter or index
  * h: handle that is operated on
  * n, m: size, count (number of things to operate on)
  * s, t: strings (if two strings, s is the target, t is the source)
  * r: return value of function when it needs to be a local variable

The only really strange thing here is that opened files get called fWhatever, but are passed to IO routines receiving h as the argument. The o as member reference is derived from the use of o as Object. _o strikes me as too ugly to be useful.


Loading...