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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/04/03 16:12
Read: times


 
#54096 - RE: OT: Compiler observation
Responding to: ???'s previous message
"A decent compiler should know this sort of thing!"

A decent 8051 compiler like Keil C51 does have the means to know by virtue of its SFR extensions for on-chip registers. For off-chip device registers the problem still exists. Strictly conforming compilers (i.e., without extensions) have the means for expressing "read-only" (i.e., the 'const' qualifier), but lack a means for qualifying something as "write-only".

Probably the best one could hope for, is that qualifying a register declaration with "volatile" would suggest to the compiler that after a writing a value to the register, the register contents might change and thus should not be read as the source to propagate a value across a series of right-to-left associative assignment operators in a single statement.

In the end, it is up to the coder to either recognize that their compiler generates the desired code productions (bad practice), or to code things in an unambiguous manner that avoids this type of issue altogether.


List of 24 messages in thread
TopicAuthorDate
unpredictable first character            01/01/70 00:00      
   RE: unpredictable first character            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
   RE: unpredictable first character            01/01/70 00:00      
      OT: Compiler observation            01/01/70 00:00      
         RE: OT: Compiler observation            01/01/70 00:00      
         RE: OT: Compiler observation            01/01/70 00:00      
            RE: OT: Compiler observation            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
         RE: unpredictable first character            01/01/70 00:00      
            RE: unpredictable first character            01/01/70 00:00      
   RE: unpredictable first character            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
   RE: unpredictable first character            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
   RE: unpredictable first character            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
         RE: unpredictable first character            01/01/70 00:00      
         RE: unpredictable first character            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
      RE: unpredictable first character            01/01/70 00:00      
   it works - conclusion please            01/01/70 00:00      
      RE: it works - conclusion please            01/01/70 00:00      
         RE: it works - conclusion please            01/01/70 00:00      

Back to Subject List