About whether indenting in the source code uses the tab problem--programming language

Source: Internet
Author: User
Tips on whether indenting in source code uses the tab question

From the beginning of my first contact with C language, to do now in the embedded, see the programming language (I involved in some programming languages, such as C,c++,php,java, etc.) to introduce or compare the system of books, are required to write the source code must have good programming specifications, or good programming style. One point recurring is that the code is best indented, so that it can improve readability, and in the next to a specification often with indentation is the best use of space words, this is not a sense of the term has aroused a lot of my interest.

Recall reading the so-called "Huawei Programming code" "Google Programming Norms" and other information, there are similar words. But as far as I'm concerned, it's unreasonable to let programmers use a TAB key to get things done, and it's very rude to spend four times times the time on four spaces, especially in code where the tab indent may be used for every row.

The reason for the existence of the "indent Best Use Space" is that the reason given in these authoritative books is that when someone uses your code, it may be different from the tab number you set, causing the code to be mangled and difficult to read.

This means that the specification exists only because of the error setting of the "compatible" reader.

The compilers I used are basically the number of spaces that support custom tab tabs, such as those in the Microsoft SDK series, and the various series of Ides based on Eclipse. Plus, if a code editor doesn't even have a custom tab that takes up a number of spaces, it should be eliminated.

If, in order to simply be compatible with other "reader" reading effects, the current mainstream editor supports an INSERT spaces option (usually next to the number of space options that the Custom Tab tab occupies), This option generally means that the editor can convert the space occupied by the Tab tab to spaces when the code is saved.

Of course, I listed above are all my usual study work in the use or contact, I was the first time in the canton to learn C programming language, the teacher recommended the use of the IDE is a particularly magical and ancient compiler, named Turboc. This compiler has been the antique of the last century, only used in teaching, the purpose is not to use the hint function, students in the code on some feel. That kind of thing is used at work, it is simply "back before liberation."

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.