I have read what I could find on pointers in C/C++ but most of it is introductory, and while it helps you to understand using them there are many cases where existing code throws examples that are troublesome to decipher.
I did see some examples where they break down a line of code into what it really means and some of the more complex ones end up with something like: "a pointer to a function that returns a pointer to a pointer of an int"
Ok great, but what kind of scenario would you run into where you would end up with this? Is this sort of pointer situation something that comes up often? It does not seem very readable and if you had code full of this I could see a great possibility of bugs popping up.
I have found one line of code in a library that I do not fully understand but it is not quite the crazy deciphered example listed above: *(uint8_t *)&(SPI2->DR) = SPI2_DATA;
SPI2_DATA is getting assigned to the DR of SPI2, but what is all that other code for?
As far as I can tell the code is doing a bitwise AND between a pointer to a uint8_t and the DR of SPI2 and then dereferencing the whole thing to assign SPI2_DATA to it. I know that is not right though?