Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/13/11 08:35
Read: times


 
#180544 - works
Responding to: ???'s previous message
The new version compiles ((char *)0)[0x10] = 0; without a single complaint.

This is a bit strange, as ((char *)1)[0x10] = 0; warns about "cast of LITERAL value to 'generic' pointer". I'd say this would be appropriate for the null constant cast to non-(void *) (i.e. creating null pointer) too.

I also maintain my objections to using null pointer as a base for "indexing" (array subscripting). C99 in 6.5.2.1 requires "one of the extensions shall have type "pointer to object type"*; while the status of null pointer is IMHO that it is not a pointer to object.

I know this is hair-splitting and PITA, but once we are discussing it... :-)

Jan


---
* Btw., SDCC violates the standard by not supporting the "reverse" array subscripting, e.g. 0x10[((char *)1)], however perverse that idea is; but I am not going to put this as a feature request *exactly* because it IS perverse.


List of 25 messages in thread
TopicAuthorDate
sdcc internal error / C syntax            01/01/70 00:00      
   legality of indexing NULL pointer            01/01/70 00:00      
      bug            01/01/70 00:00      
         version            01/01/70 00:00      
            version revisited            01/01/70 00:00      
               thank you            01/01/70 00:00      
                  Fixed            01/01/70 00:00      
                     no snapshot            01/01/70 00:00      
                        works            01/01/70 00:00      
                           0 is special - but so is NULL. indexing around NULL is bad            01/01/70 00:00      
                              No guarantee that a NULL pointer points to any memory            01/01/70 00:00      
            time            01/01/70 00:00      
               I know :-(            01/01/70 00:00      
       Use of __at ?            01/01/70 00:00      
         What is "that way"?            01/01/70 00:00      
            the antique version....            01/01/70 00:00      
            XBYTE macro            01/01/70 00:00      
               Okay, then the following definition...            01/01/70 00:00      
                  RE: David's remarks about volatility            01/01/70 00:00      
   Close, but no cigar            01/01/70 00:00      
   Avoid the 'volatile'            01/01/70 00:00      
      instead of offsetting...            01/01/70 00:00      
         Dereferencing a '_REG            01/01/70 00:00      
            I agree            01/01/70 00:00      
      Use of __at ? [ed]            01/01/70 00:00      

Back to Subject List