您使用FreeRTOS教程作为C++的示例。如果你看看FreeRTOS的sources,你会发现它实际上是用C编写的,而不是C++。
在C语言中引入C风格的单行注释(//
)之前并不存在于C语言中。很多代码,包括教程,都是在C99之前编写的。甚至可以编写新的C代码而不使用新的语言功能,以保持程序与不支持新规范的较旧编译器兼容 - 或仅仅由于旧习惯或偏好。
我一直觉得这是一个有点讨厌,因为它阻止我如果有必要
使用此注释掉的代码块临时禁用的代码块:
#if 0
/* Bits in this RTOS task's notification value are set by the notifying
tasks and interrupts to indicate which events have occurred. */
xTaskNotifyWait(0x00, /* Don't clear any notification bits on entry. */
ULONG_MAX, /* Reset the notification value to 0 on exit. */
&ulNotifiedValue, /* Notified value pass out in
ulNotifiedValue. */
portMAX_DELAY); /* Block indefinitely. */
#endif
对于多行注释来说,这很容易。使用// vs/* * /仅仅是一种没有正确技术的样式选择 –
很长一段时间'''''''''''* /''是所有可用于便携式C的类型。因此,旧的C程序员更可能选择这种形式。请注意,在你的例子中'&ulNotifiedValue'是一个C风格的超参数。 –
不确定为什么你标记为C++? FreeRTOS是用C编写的。 –