2 Replies Latest reply on Apr 25, 2014 2:42 AM by tamir

    how to declare GLOBAL register int variable?

    tamir

      hi,

      I need it for fast I/O

      using just register int x

      before the setup() doesnt compile

       

      thanks

        • 1. Re: how to declare GLOBAL register int variable?
          dferyance

          This is not supported by the C++ language. The "register" storage-class specifier can only be used at block scope or in parameters. Even if it was supported, it seems like a really bad idea to reserve a CPU register for an entire application based off of a single use of it.

           

          You should not try to use "register" even in cases where it is allowed. This is deprecated by the C++ language and most compilers ignore it. The language lets them ignore it (it is just a hint) and it generally makes sense to do so. Let the compiler handle code generation.

          • 2. Re: how to declare GLOBAL register int variable?
            tamir

            thanks for a well written answer !

            now, I need fast INPUT there for wanted to use a "global register int" variable

            anyone knows how to achieve 100KHz INPUT with the GALILEO (pins 2,3 - with INPUT_FAST mode on)

             

            thanks!