Look at this long expression of function declaration

Look at this long expression of function declaration

extern FUNC( Std_ReturnType, FEE_CODE ) Fee_Write(
VAR( uint16, AUTOMATIC ) BlockNumber,
P2VAR( uint8, AUTOMATIC, FEE_APPL_DATA ) DataBufferPtr);

There are four macro in this expression: FUNC, VAR, P2VAR, Std_ReturnType, these definition

/*
* @violates @ref Compiler_h_REF_4 In the definition of a function-like macro each instance of a
* parameter shall be enclosed in parentheses
*/
#define FUNC(rettype, memclass) rettype

/*
* @violates @ref Compiler_h_REF_4 In the definition of a function-like macro each instance of a
* parameter shall be enclosed in parentheses
*/
#define VAR(vartype, memclass) vartype

/*
* @violates @ref Compiler_h_REF_4 In the definition of a function-like macro each instance of a
* parameter shall be enclosed in parentheses
*/
#define P2VAR(ptrtype, memclass, ptrclass) ptrtype *

/**
* @brief This type can be used as standard API return type which is shared between the RTE and the
* BSW modules.
* @implements DBASE12002
*/
typedef uint8 Std_ReturnType;

So the long declaration expression should look like this after precompile :

extern uint8 Fee_Write(uint16 BlockNumber, uint8* DataBufferPtr);

It’s simple, So don’t be scared by the long expression.

PS: AUTOSAR <Specification of Compiler Abstraction> defined how to implement the Complier.h file.

 

分享到: 更多
版权申明:

本站保留所有原创文章的版权,本站地址:奔跑的博客[http://www.elecbench.com]

原创文章转载时请注明出处,并添加文章所在页面的链接:http://www.elecbench.com/look-at-this-long-expression-of-function-declaration/

本站所有 2010年3月4日 以后发表、未标明为“转载”的文章均是本站原创。

发表评论


(设置自己的个性头像)

*

申请属于你的免费顶级域名