1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton

David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

Hungarian Notation or What?

Tuesday May 13, 2008
In case you didn't know it, Hungarian names are apparently given in the order family names first then personal name. This was the reason given for Hungarian Notation where variable names had identifiers like lpFred (Fred is a long pointer). C and C++ developers on Windows will be familar with this. It was created by was invented by Charles Simonyi, a programmer at Xerox Parc who later became Chief Architect at Microsoft. The idea was that variable names were somewhat self-documenting. This was before IDEs had nifty lookups.

I've never been a great fan of this; I'd rather have longer more meaningful names such as CurrentUserCount, where you'd expect that the variable would be an int as it's a counter. It doesn't matter which language you use, so long as you are consistent. For work I try and minimize the effort needed by future developers of my code to understand it. But I'm interested in knowing- are there any other naming conventions ( not Pascal Case or camelCase which use capitalization) that you use to simplify this sort of thing?

Comments

May 14, 2008 at 9:24 am
(1) Jason says:

I use an underscore at the beginning of a local variable to give it the same name as a variable that has an equivalent purpose as a variable in a higher scope.

An underscore at the beginning could also be used to designate a private variable.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore C / C++ / C#

More from About.com

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2008 About.com, a part of The New York Times Company.

All rights reserved.