I need to display some relevant information in #error preprocessor directive. For example:
#define myConstant 5
#if myConstant > 10
#error myConstant has to be > 10, now %d //should display "5"
#endif
Run Code Online (Sandbox Code Playgroud)
How can I do that?
我很惊讶为什么得到不同的结果。
uint16_t wCaptureTime = 35;
wDeltaTime1 = (uint16_t) - (int16_t)wCaptureTime;
wDeltaTime2 = 0xFFFF - (int16_t)wCaptureTime;
printf("wDeltaTime1 %d \n", wDeltaTime1);
printf("wDeltaTime2 %d \n", wDeltaTime2);
Run Code Online (Sandbox Code Playgroud)
该代码导致:
wDeltaTime1 65501
wDeltaTime2 65500
Run Code Online (Sandbox Code Playgroud)
有人可以解释或提供一些链接以了解该行为。