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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/09/07 15:43
Read: times


 
#130514 - wrong warnings
Responding to: ???'s previous message
There are more warnings that fail occasionally, especially if one sometimes for a good cause departs from "guidelines" (and, as you said, still might be correct) - that's why compilers have pragmas to disable warnings *locally* (OK this does not work particularly well on SDCC I found out in the mentioned experiment). I see no problem in this.

-------------

Erik Malund said:
You will not ever know when the compiler (fail to) disable and reenable the interrupts.

I don't understand.

Let's talk about this scheme:

  • I declare a variable critical.
  • if this is a single-byte variable, this is ignored by compiler... (OK this was simple :-) )
  • when this variable is used,

    • if this is in a section of code () tagged already as critical, it is used normally
    • otherwise interrupts are disabled (interrupt flag stored) before variable usage and restored after it

      • extension: alternatively, user defined "disable"/"enable" function/inline function/macro can be used


I see no problem with this except it might not be too optimal - but who told C programs shall be optimal? There is no problem to fall back to "standard" "manual" disable/enable - simply don't flag the variable as critical.

Can you please point me out what's fundamentally wrong on this scheme (there still might be problematic *details* of course - I am not a compiler maker).

JW


List of 32 messages in thread
TopicAuthorDate
atomicity, multibyte variables, C and my comfort            01/01/70 00:00      
   No way            01/01/70 00:00      
      Well, theoretically ...            01/01/70 00:00      
   Yes sdcc at least            01/01/70 00:00      
      Keil            01/01/70 00:00      
   Does it matter?            01/01/70 00:00      
      sort of...            01/01/70 00:00      
         Lack of this feature ...            01/01/70 00:00      
            really?            01/01/70 00:00      
   talking out of both sides of the mouth            01/01/70 00:00      
      :-)            01/01/70 00:00      
         the simple solution            01/01/70 00:00      
            The question was not how to fix it...            01/01/70 00:00      
   Don't disable            01/01/70 00:00      
      C extensions            01/01/70 00:00      
         ring buffer, atomicity and C            01/01/70 00:00      
            OK that was a stupid example...            01/01/70 00:00      
      Hardware solution called for            01/01/70 00:00      
         isn't HLL supposed to hide the low level details?            01/01/70 00:00      
            the skinny            01/01/70 00:00      
               Word length & Atomicity            01/01/70 00:00      
            Side effects            01/01/70 00:00      
               questions and answers            01/01/70 00:00      
                  Embedded Specific            01/01/70 00:00      
                     Neil, you GOT it            01/01/70 00:00      
                        waitaminute...            01/01/70 00:00      
                           from an old hand to a newbie            01/01/70 00:00      
                              what helps is good (?)            01/01/70 00:00      
                                 The warning you propose would be 'wrong' in some c            01/01/70 00:00      
                                    wrong warnings            01/01/70 00:00      
                                       Read-Modify-Write            01/01/70 00:00      
                                          OK then not simple            01/01/70 00:00      

Back to Subject List