Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

21
  • 4
    It has nothing to do with C or IDEs. The notation was intended for BCPL (the predecessor to C), which lacks C's data types and does not distinguish between integers, pointers, etc. Variables in BCPL are defined in terms of machine words, so the notation is intended to encode semantics which don't exist in the language. Prefixes for primitive C or C++ data types have never been necessary because compilers do the job. It's more an accident of history that this was lost in translation at Microsoft, where the notation was adopted and popularised for Win32. Commented Dec 22, 2023 at 14:26
  • 3
    @BenCottrell, the OP specifically asked about C and about Windows! I'm obviously not saying C was the first language to lack adequate types, or that Simonyi was the first to use a system of prefixes. A string is not a "primitive" in C. I'm also surprised that you say it's nothing to do with IDEs - clearly, modern language IDEs are capable of providing various information that once had to be encoded explicitly in text for the ergonomics of the programmer. Commented Dec 22, 2023 at 14:42
  • 13
    @BenCottrell You might be interested in apps Hungarian, which is about making it clear what the value is, not what type it has. For instance, if you end up adding xwFoo + cbBar, you may start to suspect that you've done something wrong because it doesn't usually make much sense to add a buffer size to a horizontal screen coordinate. Labeling them both as i for integer, of course, tells you nothing the compiler can't. Commented Dec 22, 2023 at 16:25
  • 5
    @BenCottrell, in C, the question of whether the string is length-prefixed or sentinel-terminated is not known to the compiler, and anyway the more important question is not whether the compiler knows the data type but whether the programmer can easily read and distinguish the data type in context. I can easily imagine Microsoft had programmers working in circumstances where it was necessary to constantly rehearse as part of the variable names the subtle differences in data types, because occasionally I encounter such situations myself, where there's no hope of keeping track otherwise. Commented Dec 22, 2023 at 23:03
  • 5
    @BenCottrell "humans have no need to check the types as the compiler will do that job." You've either got an amazing memory, or never accidentally added two shorts into a short and watched it overflow. Commented Dec 23, 2023 at 5:39