home bbs files messages ]

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,780 of 243,242   
   James Kuyper to All   
   Re: NULL dereference in embedded [was: O   
   05 Jan 26 06:41:13   
   
   From: jameskuyper@alumni.caltech.edu   
      
   On 2026-01-04 19:16, Lawrence D’Oliveiro wrote:   
   > On Sun, 4 Jan 2026 16:53:16 -0500, James Kuyper wrote:   
   >   
   >> On 2026-01-04 16:22, Lawrence D’Oliveiro wrote:   
   ...   
   >>> In this case, it’s not clear what choice you have.   
   >>   
   >> I may have lost the thread here - which choice are you talking   
   >> about?   
   >   
   > What if the entire machine address space is valid? Are C pointer types   
   > supposed to add an extra “invalid” value on top of that?   
      
   An implementation of C (keep in mind that the implementation includes   
   the compiler, the linker, and the C standard library) can use any   
   location they want for a null pointer, just so long as they make sure   
   that no C object accessible to the user is stored in that location. No   
   user-defined object should be allocated in that location, and no pointer   
   returned by any standard library function (such as malloc() or   
   asctime()) can return that location. If memory is tight, the   
   implementation may use that location to store anything that is never   
   supposed to be accessible to the user.   
   Alternatively, pointers can be larger than needed to store just a   
   machine address, and at least one bit of the extra space can be reserved   
   to identify the pointer as null.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca