[英]Is there a kind of docblock syntax for C? Does it work in STM32CubeIDE?
Let's say I have a function declaration:假设我有一个函数声明:
int32_t get_adc_reading();
I want to get any kind of help without peaking to the header file, so...我想在不访问头文件的情况下获得任何帮助,所以......
/**
* Gets a reading from ADC.
* @retval 12-bit reading value.
*/
int32_t get_adc_reading();
The IDE seems to ignore the comment. IDE 似乎忽略了注释。 Is it even valid?
它甚至有效吗? Is "@retval" valid?
“@retval”有效吗? Is it documented somewhere?
它在某处记录了吗?
I try to Google it, but I get nothing.我尝试谷歌它,但我什么也没得到。
Maybe I don't know how to ask.可能我不知道怎么问。 I coded mainly in C# before, I'm learning C now.
我以前主要用 C# 编码,我现在正在学习 C。
In C# it was normal I could put a docblock
over any object to get IDE hint about that object.在 C# 中,我可以在任何对象上放置一个
docblock
来获取有关该对象的 IDE 提示,这很正常。 It worked in JavaScript in most editors I used.它在我使用的大多数编辑器中都适用于 JavaScript。 It worked in Python.
它在 Python 中工作。
Does something like this even exists for C, and if so - where can I find a documentation for it? C 是否甚至存在这样的东西,如果是这样 - 我在哪里可以找到它的文档?
Another weird thing I experience while learning C and using Google:我在学习 C 和使用 Google 时遇到的另一件奇怪的事情:
"It looks like there aren't many great matches for your search" “您搜索的匹配项似乎并不多”
It's even weirder that I often find what I'm looking for much later and see it matches my query, however for some weird reason Google doesn't find it.更奇怪的是,我经常在很久以后才找到我要查找的内容并发现它与我的查询相匹配,但是由于某种奇怪的原因 Google 没有找到它。 Let's say my page contains words "plasma capacitor".
假设我的页面包含“等离子电容器”字样。 It is about plasma capacitor.
这是关于等离子电容器。 But it's somehow related to C. Let's say it's a C library.
但它在某种程度上与 C 相关。假设它是一个 C 库。 I enter "plasma capacitor" in Google and get the infuriating message.
我在 Google 中输入“等离子电容器”并收到令人愤怒的消息。 Then I'm looking for something completely different, but a little related, then I click on link there, and BLAM: "plasma capacitor" - it is there, but it's just not returned from search.
然后我正在寻找完全不同但有点相关的东西,然后我点击那里的链接,然后 BLAM:“等离子电容器” - 它在那里,但它没有从搜索中返回。
Unlike C# there isn't a standard comment documentation format for C++.与 C# 不同,C++ 没有标准的注释文档格式。 The most used one is Doxygen .
最常用的一种是Doxygen 。
However most modern IDEs can display info about symbols gathered from comments, even if the comments don't follow a particular format.然而,大多数现代 IDE 可以显示有关从注释收集的符号的信息,即使注释不遵循特定格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.