I once was overjoyed to come across this little gem:
Code:
strncpy(destination, source, strlen(source));
The code was written by an MS employee, unhappily enough.
<hr>
Hungarian notation is pure shit. It's fucking demented. <tt>r</tt> for <tt>float</tt> because <tt>r</tt> means real. That C calls them <tt>float</tt> and <tt>double</tt>/<tt>long double</tt>, and even goes so far as to use <tt>f</tt> on the end of numbers to force them to be <tt>float</tt>s is apparently not a sufficiently good reason to use <tt>f</tt> for <tt>float</tt>. <tt>f</tt> is for flags. Unless it's a single flag, in which case it's <tt>b</tt>, for <tt>BOOL</tt> or <tt>bool</tt>. Except when you use <tt>b</tt> to mean byte. Using <tt>r</tt> for <tt>float</tt> then means that you can't use <tt>r</tt> for references, even though it would make much more sense. Then we have pointers. Whilst <tt>l</tt> would have been a useful qualification a decade ago, it's nowadays completely redundant, as there are no near, far, or huge pointers left. They're all <tt>l</tt>, so no useful information is imparted by the <tt>l</tt>, but still it's there.
Then we have wonderful things like <tt>w</tt>, for <tt>WORD</tt>. That <tt>WORD</tt> is an ill-defined concept at best (platforms all seem to disagree about how long a word actually is). Windows says it's 16 bits. Which is great, until we look at, say, WndProcs, which have <tt>wParam</tt>s which are, of course, 32-bits wide. Yes, they're <tt>DWORD</tt>s. Then there's the whole mess of <tt>DWORD</tt>s on Win64; there are a bunch of new <tt>DWORD</tt> types, including <tt>DWORD64</tt>s, which are 64 bits long no matter what, despite <tt>QWORD</tt>s not being lengthened to 128 bits.
<tt>c</tt>. What's it mean? It can mean count, usually in bytes, but sometimes something else such as <tt>TCHAR</tt>s. It can mean <tt>const</tt>. It can mean <tt>char</tt>. <tt>lpc</tt> being distinct from <tt>sz</tt> (or <tt>str</tt>) and <tt>wsz</tt> (or <tt>wstr</tt>), because <tt>sz</tt> means an ASCIIZ (and <tt>wsz</tt> UNICODEZ) string, rather than a simple <tt>char</tt> or <tt>wchar_t</tt> pointer.
If you want an <tt>int</tt>-type type, you might use <tt>n</tt>, unless you use <tt>i</tt>, and you may use <tt>u</tt> or <tt>s</tt> as <tt>unsigned</tt>/<tt>signed</tt> qualifiers, unless you use <tt>dw</tt> to mean <tt>DWORD</tt> which is <tt>typedef</tt>ed to <tt>unsigned long</tt> in any case, in which case you probably use <tt>l</tt> to mean <tt>long</tt>, which is <tt>signed</tt>.
Hungarian notation is truly hateful.
<hr>
There are many other hateful things. For instance, I'm currently fixing an application that has a number of classes with save methods. Except it doesn't. They all save their results to a database. Some are called <tt>DBSave()</tt>. Some just <tt>Save()</tt>. Others <tt>SaveToDB()</tt>. All notionally equivalent, all different. They all take similar or the same parameters, but they do not all take them in the same order. So one has to learn each class separately and think each time, "which save method does this class have?".
Visual Basic has a charming feature that lets you do this:
which allows you to declare a variable of type <tt>MyType</tt> called <tt>MyType</tt>. This I find quite offensive. I don't mind in a language like C++, which is case-sensitive, where one might have classes with Initial Caps and instances of classes with lower-case initial letters. It keeps them separate from each other. But VB lets you mix the two namespaces for some unfathomable reason.