简体   繁体   English

mplab xc8 / 16 builtin_constant_p

[英]mplab xc8/16 builtin_constant_p

I was searching for this in the mplab compiler users guide but haven't found anything. 我在mplab编译器用户指南中搜索了这个,但没有找到任何东西。 I am asking it here to confirm that I am not blind or anything: 我在这里要求确认我不是盲人或任何事情:

The GCC compiler provides some very interesting and useful built-in functions like __builtin_constant_p(x) or similar stuff. GCC编译器提供了一些非常有趣和有用的内置函数,如__builtin_constant_p(x)或类似的东西。 I have never found anything like that in the microchip compilers and I don't think there is. 我从来没有在微芯片编译器中找到类似的东西,我认为没有。

So the question: Do Microchip XCxx Compilers provide any non-standard built-in functions apart from the device specific ones (like declaring variables at a given register address or declaring an interrupt function)? 所以问题是:Microchip XCxx编译器是否提供除设备特定功能之外的任何非标准内置功能(如在给定寄存器地址处声明变量或声明中断功能)?

EDIT: To clarify some more: I am mostly interested in retrieving information from the compiler. 编辑:澄清一些:我最感兴趣的是从编译器中检索信息。 A good example would be something like builtin_constant, as it makes information available to the program which is normally not usable. 一个很好的例子就像builtin_constant,因为它使程序可用的信息通常不可用。 But I do not limit this question to find constant expressions only. 但我不限制这个问题只能找到常量表达式。

google和out roll中的XC16手册: http ://ww1.microchip.com/downloads/en/DeviceDoc/50002071E.pdf附录G.

The same document mentioned by @Marco van de Voort has a list of pre-defined macros in section 19.4 that give you information about the compiler environment and the device. @Marco van de Voort提到的同一文档在第19.4节中有一个预定义宏列表,它为您提供有关编译器环境和设备的信息。

There is also the somewhat undocumented __DEBUG macro which is defined when running under MPLABX in debug mode (MPLABX defines this in the call to the compiler). 还有一些未记录的__DEBUG宏,它是在调试模式下在MPLABX下运行时定义的(MPLABX在调用编译器时定义了这个)。

These are the builtins supported by the XC16 compiler 这些是XC16编译器支持的内置函数

在此输入图像描述

eg __builtin_add 例如__builtin_add

在此输入图像描述

For a complete description of the builtins see the MPLAB XC16 compiler user's manual (under "docs" folder of compiler installation) or here: http://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en559023 有关内置函数的完整说明,请参见MPLAB XC16编译器用户手册(在编译器安装的“docs”文件夹下)或此处: http//www.microchip.com/mymicrochip/filehandler.aspx? docname = en559023

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM