I'm reviewing some code and I stumbled across this:

In a header file we have this MAGIC\_ADDRESS defined

```
#define ANOTHER_ADDRESS ((uint8_t*)0x40024000)
#define MAGIC_ADDRESS (ANOTHER_ADDRESS + 4u)

```

And then peppered throughout the code in various files we have things like this:

`*(uint32_t*)MAGIC_ADDRESS = 0;`
and
`*(uint32_t*)MAGIC_ADDRESS = SOME_OTHER_DEFINE;`

This compiles, apparently works, and it throws no linter errors. `MAGIC_ADDRESS = 0;` without the cast does not compile as I would expect.

So my questions are:

* Why in the world would we ever want to do this rather than just making a uint32\_t in the first place?
* How does this actually work? I thought preprocessor defines were untouchable, how are we managing to cast one?