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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/06/07 09:22
Read: times


 
#142807 - both
Responding to: ???'s previous message
Oliver Sedlacek said:
The code modifier is a non standard extension to C, while const is standard. I recommend the standard way.

The 'code' extension specifically tells the (Keil) compiler to locate the item in the 8051's CODE space.

The 'const' standard modifier simply tells the compiler to treat any attempt to modify the item as an error - it does not necessarily direct the compiler to locate it to any specific memory area.
eg, you might use 'const' for a read-only memory-mapped IO in XDATA space...

I'm not sure if the Keil compiler treats 'code' as implicitly 'const', but it can't hurt to specify both!



List of 22 messages in thread
TopicAuthorDate
A Simpler Way?            01/01/70 00:00      
   Logical AND ?            01/01/70 00:00      
   Shift?            01/01/70 00:00      
      I Agree.            01/01/70 00:00      
   Another Option            01/01/70 00:00      
   the simplest way            01/01/70 00:00      
      capitals            01/01/70 00:00      
         I copyued what the OP used            01/01/70 00:00      
         The common use of CAPs in C            01/01/70 00:00      
            totally agree, however            01/01/70 00:00      
               Why are you rambling about variables...            01/01/70 00:00      
                  not to me            01/01/70 00:00      
         Variable capitalisation?            01/01/70 00:00      
            'code 'never is            01/01/70 00:00      
               Did not think it mattered.            01/01/70 00:00      
               Code modifier            01/01/70 00:00      
                  both            01/01/70 00:00      
                     Use both            01/01/70 00:00      
                        C++ ?            01/01/70 00:00      
                           Mixed            01/01/70 00:00      
                        Extensions            01/01/70 00:00      
                           Experience            01/01/70 00:00      

Back to Subject List