Re: Passing a reference to a std::map
Giovanni Dicanio wrote:
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel
messaggio news:oma7q41h2vica5uqp8l212ghl4mvj8mnu7@4ax.com...
THe superficial scanning is the same excuse for using m_ for member
variables, and
Hungarian notation, both of which are pointless with VS; you can
hover over the variable
and learn about it, or go to its declaration in a single keystroke
or two mouse clicks,
and the punched-card mentality that says we have to use these
contextual clues because it
is too hard to find the declaration are simply pointless arguments.
Hi Joe,
I think that we should differentiate between different kinds of
Hungarians, I mean: so called "Systems Hungarian" vs. "Apps
Hungarian".
However, Apps Hungarian is completely different and IMHO it can
improve the quality of code.
The Apps Hungarian of the aforementioned variable would be:
DWORD cchMaxLen;
The prefix 'cch' is important, in fact it gives the reader
information about the *semantic* of the variable, the fact that the
variable (whose type is DWORD) stores a *count* of *characters*
('cch'). So, I think that the Systems Hungarian prefix 'dw' is
pointless,
but the Apps Hungarian prefix 'cch' is helpful.
No, it's not!
If you want the value to mean max chars, why call it cchMaxLen and not
just MaxChars? Then you have MaxBytes for your other value.
In fact, we could have:
DWORD cchMaxLen;
DWORD cbMaxLen;
These variables are both of type DWORD, but when we read 'cch' we
understand that the count is in characters, instead when we read
'cb' we understand that the count is in bytes. These counts are the
same
for ANSI strings, but are different for WCHAR's strings!
No, this is just another variation of the wParam and lParam of Windows
programming. Which were once a bad choice with good intentions, but
are now just outright lies.
Terrible!
Bo Persson