11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Extended keywordsFor more examples of using memory attributes, see More examples, page 19.An easier way of specifying storage is to use type definitions. The following twodeclarations are equivalent:typedef char __data20 Byte;typedef Byte *BytePtr;Byte b;BytePtr bp;and__data20 char b;char __data20 *bp;Note that #pragma type_attribute can be used together with a typedefdeclaration.Syntax for type attributes on data pointersThe syntax for declaring pointers using type attributes follows the same syntax as thetype qualifiers const and volatile:int __data20 * p;int * __data20 p;__data20 int * p;The int object is located in __data20 memory.The pointer is located in __data20 memory.The pointer is located in __data20 memory.Syntax for type attributes on functionsThe syntax for using type attributes on functions, differs slightly from the syntax of typeattributes on data objects. For functions, the attribute must be placed either in front ofthe return type, alternatively in parentheses, for example:__interrupt void my_handler(void);orvoid (__interrupt my_handler)(void);The following declaration of my_handler is equivalent with the previous one:#pragma type_attribute=__interruptvoid my_handler(void);OBJECT ATTRIBUTESObject attributes affect the internal functionality of functions and data objects, but nothow the function is called or how the data is accessed. This means that an object attributedoes not need to be present in the declaration of an object.Part 2. <strong>Compiler</strong> <strong>reference</strong>191

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!