The Cave

21 Dec

Hungarian Notation

Aha! The good reason to use Hungarian Notation:

thread_local X tlsX;

Warts like “tls” and “i” are about lifetime and usage, not type.

The only times I use Hungarian Notation are a handful of prefixes (e.g. in C++):

  • m_ => member (instance) attribute
  • g_ => global (static/class) attribute
  • p => pointer (N-times, e.g. int**ppNumber;)

I’ve never used thread_local (yet, though I have used the Win32 TLS API), but I’ll have to add that to my list.

I find myself using a similar but alternative style of notation in Objective-C:

  • _name => Objective-C (@interface) attributes that are Objective-C objects
  • name => Objective-C (@interface) attributes that are C data types

At least, so far. I’m still a relative newbie at OBjective-C. I’m working on it :-)

FacebookGoogle GmailGoogle BookmarksTechnorati FavoritesTwitterHotmailYahoo MailYahoo MessengerWordPressStumbleUponRedditEmailInstapaperGoogle+Share

Comments are closed.

© 2015 The Cave | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo