[FRIAM] What's in a name? MOTH to a Flame

Russell Standish lists at hpcoders.com.au
Fri Nov 6 23:51:01 EST 2020


On Mon, Nov 02, 2020 at 11:24:39AM -0500, Barry MacKichan wrote:
> When I interviewed at Microsoft, one of my interviewers was Charles Simonyi,
> the originator of what is called “Hungarian”. It is a small set of rules and a
> bunch of prefixes used to encode type information in variable and function
> names. For example, ‘lpszName’ is the name of a long pointer to a
> zero-terminated string. It doesn’t work well when there are a lot of
> user-defined types, such as C++ classes.

It doesn't work well at any point. Basically, the name could be lying,
for example if the implementation has been changed, but the variable
name not. Therefore, if you need to know the type of something, then
you need to look it up (modern IDEs make this pretty easy), not assume
that the variable name tells you anything about it's type. Also, there
are some many variants of "Hungarian", it gets pretty silly after a
while. Years of reading code has taught me to filter out hungarian
prefixes as meaningless line noise.



-- 

----------------------------------------------------------------------------
Dr Russell Standish                    Phone 0425 253119 (mobile)
Principal, High Performance Coders     hpcoder at hpcoders.com.au
                      http://www.hpcoders.com.au
----------------------------------------------------------------------------



More information about the Friam mailing list