In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use double slash notes in Tool. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Many coders are used to using double slashes (/ /) when commenting on a single line because it is easy to type.
But VxWorks developers may have a problem.
The image above is to add a c file to Workbench's DKM project, which contains only a double slash, and the compilation project reported an error: expected identifier or'('before' / 'token')
Similar problems are encountered in Tornado. Why is that?
Because in this project, the compiler used by IDE is gnu, and the compilation rules contain-ansi by default
From the gnu manual, you can see that-ansi is equivalent to-std=c89, while double slashes were not supported in the C89 era.
The problem has been found, how to solve it? The simplest and most rude way is to delete it!
Try compiling again.
Got it!
Jingxi Huizi temples, righteous theory to the essence of the study. It's just not done yet. we need to know why. Keep reading the manual.
After the original deletion of-ansi, IDE reset the rule to-std=gnu89, and it was gnu89 that made some extensions to c89, including this double slash comment.
What if we just set the rule to gnu89, or even c99, gnu99 and so on?
Give it a try. It's all right.
However, after all, compared with c89, c99 changes too much, and the compilation rules change too much, which may involve the problem of code migration or compatibility, which requires the project manager or technical leader to co-ordinate and customize the rules. In fact, many companies develop their own coding specifications, which include rules for the writing of comments. So let's start with gnu89 here.
Just verified is the DKM project, let's open VIP to have a look. The ansi option in VIP is provided in the form of a radio box, so how do you modify it?
Just fill it out in User Flags.
This is the problem with the gnu compiler compiling double slash comments.
When it comes to the gnu compiler, do you have another idea? Yes, the diab compiler is used to compile the project.
Try it, and sure enough, it's no problem. Doesn't diab use the ansi option by default? Take a look at Build Console, which uses the option-Xansi
What the hell is this? Look at the diab manual. The full name of Xansi is-Xdialect-ansi. It turns out that it is a special improvement made by the manufacturer, just like the improvement of C89 by gnu89.
To see what it has improved, there is indeed this one.
This is the end of this article on "how to use double slash comments in Tool". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.