Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 242,766 of 243,242    |
|    David Brown to highcrew    |
|    Re: NULL dereference in embedded [was: O    |
|    04 Jan 26 17:16:22    |
      From: david.brown@hesbynett.no              On 04/01/2026 00:25, highcrew wrote:       > On 1/4/26 12:15 AM, highcrew wrote:       >> I have a horrible question now, but that's for a       >> separate question...       >       > And the question is:       >       > Embedded systems. Address 0x00000000 is mapped to the flash.       > I want to assign a pointer to 0x00000000 and dereference it to       > read the first word.       > That's UB.       >       > How do I?       >       > Now I guess that an embedded compiler targeting that certain       > architecture where dereferencing 0 makes sense will not treat       > it as UB. But it is for sure a weird corner case.       >              There are some common misconceptions about null pointers in C. A "null       pointer" is the result of converting a "null pointer constant", or       another "null pointer", to a pointer type. A null pointer constant is       either an integer constant expression with the value 0 (such as the       constant 0, or "1 - 1"), or "nullptr" in C23. You can use "NULL" from        |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca