Hacker News new | past | comments | ask | show | jobs | submit login

    *(uint32_t *)0x40021018 = 0x00000004;

Actually that line is not ok. But for another reason. Without "volatile" in there, the compiler may reorder this access with others, or remove it, or combine it with others. None of that is good.

That's a very important call-out. This is the kind of tear-your-hair-out stuff that's going to be very difficult to track down unless you get it exactly right. I echo that using the definitions makes the code infinitely more readable and writeable, and makes zero difference in terms of performance.

Thanks, I updated the post.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact