VC smart sensing history-intelliisense history, part 1

Source: Internet
Author: User

Hello everyone, I'm Jim Springfield. I want to begin to explain our plan, about fundamentally changing C/C ++'s smart perception andCodeHow the browsing function works. Recently, the GDR and vs2008 changes in vs2005 are very important, but they have not implemented these features. ThisArticleIt covers the history of this feature and helps us explain how smart sensing is done in the next release of VC10 (vs2008.

Most of the summaries are events in source self-memory and all of these visual C ++ old versions of experience.

Obtain C or C ++ProgramThe structure information has been in Microsoft products for a long time. Before, even in Visual C ++ 1.0, the compiler supports generating program information through. SBR and. bsc files. (Note: The compiler is already version 1.0 in Visual C ++ 8th, so the command line tool has been around for a while .) . The SBR file contains references and definitions of a single conversion unit generated during compilation. Next, use the BSCMAKE tool to combine these files to generate a bsc file. This file can be used to study many different aspects of the program: reference, definition, call-called relationship diagram, Macro, etc.

Since visual C ++ was founded, we have analyzed the C ++ code and the stored information it uses for IDE in some form. This analyzer has been compiled and separated from a separate command line, because ide has many functions that need to be based on the understanding of the Code, which will put a heavy burden on these situations. For example, in many code editing stages, the Code is not in a compiled state, so compilation is not executed. The earliest ide used CLW (Class Wizard) files to store such materials. These file structures are similar to an INI file and are often used on a 16-bit system before the Windows registry is developed. These can only provide the minimum information, such as class positioning and some resource information. Use a simple analyzer to generate these CLW files, which do not handle template or ANSI/Unicode issues. In addition, the special location marked with comments in the file cannot be modified. It supports the Class Wizard requirements at the lowest level in the validity period, but it does not provide sufficient information for a program.

In Visual C ++ 4.0, you can see a new feature: classview. The information displayed in the classview includes all classes, class members, and global variables. The CLW file cannot provide enough information, so a new analyzer is created to store the information in a new NCB file. NCB is the abbreviation of "no compile browse. It provides some information, but not all, required for creating a bsc file.

Visual c ++ 6.0 introduces a new analyzer (feacp) for NCB file creation ). It is called "YCB" internally because "Yes compile browse" is short, although it still produces NCB files. It is called "Yes compile browse" because the modified version actually produces NCB after compilation. With the addition and namespace, templates, and exceptions of the C ++ language, it is not ideal to maintain Multiple Resolvers. CLW analyzer is still used to generate CLW files. vc6.0 also introduces the first "smart sensing" function, such as automatic completion and parameter listing.

The NCB file is very similar to the BSC file and is a format developed for the PDB file based on a multi-stream. The NCB file is loaded into the memory and modified in the memory. When it is disabled, it is saved to NCB. Data is stored in memory and on disks in hierarchies. Most searches need to traverse these data structures.

In Visual C ++. Net (7.0), CLW files and related analysis files are finally deleted, and the class wizard function is implemented in the NCB file. In 7.1, 8.0 (Whidbey), 9.0 (orcas), there is not much change. The biggest change we saw in Whidbey is that we removed the NCB file pre-processing created for the library and SDK, provided better support for macros, and allowed 64 K files in an NCB. These are incremental improvements, but the overall structure remains unchanged.

As NCB files add more and more features, it becomes a core technology in IDE. If it is abnormal, many ide functions cannot be used. Feacp needs to process large, complex, correlated files and potentially Incorrect code. When a common header file in a project is changed, all files dependent on it will be reparsed to generate the correct information.

Note: feacp only parses the header file, but all dependent CPP files are reparsed for collecting useful information. During this period, the problem is called "Multi-mod" (multi-module reference). This occurs when a header file is used by multiple modules.

For large engineering projects, reparsing may take some time. Initially, the UI thread being parsed will occur on the foreground, which causes the IDE to be frozen. This is solved by a background thread in a later version. However, in some cases, the front-end user interface needs to display the result, and the result will be frozen no matter what method is used. In addition, frequent reparsing uses a large amount of CPU and memory and uses too much resources, which still causes user interface problems. The final adjustment is solved by running the lower thread priority and delay to idle to a certain extent. Another solution is to add three priority sequences to queue for work, which allows more important work to be processed immediately. Other problems occur because the NCB file is invalid or incorrect, so that useful information cannot be obtained from the file during compilation. There are also some problems related to NCB data concurrency and locking in the memory. Adding the ability to quickly find information based on a simple query is very difficult and requires code changes. Adding template support to the expanded NCB file format, C ++/CLI, and other language features have proved to be difficult.

All these problems are even bigger, and more complex projects are intensifying. The number of files to be reparsed may be large and the reparsing frequency may be high. In addition, "Intermittent" failures are more likely to happen when the project scale increases. All these problems have been seen and improved over time and some gradual fixes, but fundamental problems still exist.

Next time, I will introduce how to handle these problems in vc10. this is what we are currently working on.

Thank you, Jim.

Original Link
Http://blogs.msdn.com/vcblog/archive/2007/12/18/intellisense-history-part-1.aspx

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.