As I read STM32 example code I see a fair number of variables that begin with uw
. Ex:
static __IO uint32_t uwLsiFreq = 0;
__IO uint32_t uwCaptureNumber = 0;
__IO uint32_t uwPeriodValue = 0;
__IO uint32_t uwMeasurementDone = 0;
Everything has a meaning or a story behind it. What does uw
mean here?
Example Source: STM32Cube_FW_F2_V1.7.0/Projects/STM32F207ZG-Nucleo/Examples/IWDG/IWDG_Example/Src/main.c.
Download link --> click "Get Software" button next to "STM32CubeF2".
Alright, I'd like to post my own, more complete answer. Thanks to @njuffa for pointing out in a comment below my questions that "Probably:
uw
stands for 'unsigned word' in some sort of Hungarian notation," thanks to @PeterJ_01 for pointing out that the CEO of Stack Overflow has some opinions on the matter, and thanks to @Sigve Kolbeinson for pointing out in a comment under PeterJ_01's answer that the CEO of Stack Overflow's name is Joel Spolsky (as found in the link), he actually doesn't hate Hungarian notation, but rather is just upset a limited and corrupted form of it [Systems Hungarian] got traction for a while, and for giving us the actual link to the article so we can learn more and read the article ourselves.1. Here's my conclusion to answer my question:
uw
at the beginning of many STM32 example variables certainly must logically mean "unsigned word," where a "word" is 32 bits in this case. Knowing this adds a lot of clarity as I read the code, and removes some confusion about the names, so I'm glad to know this.In this case, this is a type of Systems Hungarian usage, which is frequently discouraged for languages which have explicit types, such as C and C++, since it's redundant and adds little value. Contrast this to Apps Hungarian, which I describe below, which Joel Spolsky (CEO of Stack Overflow) strongly promotes as a way to help make "wrong code look wrong."
2. Here's some additional insight (primarily about Hungarian Notation) I learned along the way from @Sigve and @njuffa via their comments and the links they provided:
You might just call this section "what exactly is Hungarian notation in computer programming?"
unsigned long myVar
now becomesunsigned long ulMyVar
. Most people seem to argue this is either of limited use or completely worthless. Joel Spolksy is not a proponent of this form of Hungarian notation, as indicated in his article, but he is strongly for Apps Hungarian style. Other opinions can be found in the "Notable opinions" section of the Wikipedia article here.us
to mean "unsafe string" ands
to mean "safe string". Many people either feel more neutral towards this method, or like it and promote it. Both Joel Spolsky (CEO of Stack Overflow) and Steve McConnel think it's a good idea and promote its usage.Note, here's a useful excerpt from Joel's article:
(emphasis added)
It means unsigned word in this naming convention. Almost not used now. But some people love it as it shows them what type the variable is. Another ones hate arguing that it is one of the worst programming habits (including the creator of the Stack Overflow ). IMO it does not matter