How to Use the VC ++ 6.0 Compiler

Source: Internet
Author: User

VC ++ 6.0 is compiled as an efficient. NET programming language. It combines the function language and the object-oriented programming language, and is perfect for programming, algorithms, technology, and exploratory development. Therefore, it can be interesting and attractive in the Process of use.

Compared with the maturity of VS 6.0, the VC ++ 6.0 compiler is indeed a little poor, and the most criticized is the poor template technical support. One of the following things I want to do is to introduce some small tricks to those who continue to miss VC ++ 6.0 to avoid some compiler defects of VC ++ 6.0.

According to the C ++ standard, the variable var defined here has a for loop and should be destroyed. That is to say, the following code is valid:

 
 
  1. for (int i = 0; i < 100; ++i)  
  2.        func();  
  3.    for (int i = 0; i < 100; ++i)  
  4.        func2(); 

The following code cannot be compiled:

 
 
  1. for (int i = 0; i < 100; ++i)  
  2.   {  
  3.        if (has_found_it())  
  4.        {  
  5.            handle_find_result();  
  6.            break;  
  7.         }  
  8.   }  
  9.   if (i == 100)  
  10.        do_not_found(); 

However, for the first part of the code, VC ++ 6.0 will report a variable I repeated definition error, while the second part of the code is compiled. To make the VC ++ 6.0 for statement seem to comply with the C ++ standard, you can do this:

 
 
  1. if (cond)  
  2.     if (1)  
  3.         for (int i = 0; i < 100; ++i)  
  4.             func1();  
  5.     else  
  6.         func2(); 

You will find it interesting. After define, The for statements compiled by VC ++ 6.0 fully comply with the C ++ standard! Due to compiler optimization, the Release version does not add any additional overhead. A friend who is fond of "cutting corners" may say: Well, it's a good idea. But -- why not:

 
 
  1. Template<ClassT1, class T2> 
  2. T1 func (T2 arg)
  3. {
  4. T1 var;
  5. ... // Process var
  6. Return var;
  7. }
  8.  
  9. Void test ()
  10. {
  11. IntResult1=Func<Int>(1 );
  12. DoubleResult2=Func<Double>(2 );
  13. };

Sorry, this usage is not supported by VC ++ 6.0. It is annoying that no error is prompted during VC ++ 6.0 compilation, but the generated Execution code is very problematic.

  1. Differences between standard input implementation methods in C and C ++
  2. How does the C ++ compiler allocate storage space for Const constants?
  3. Basic Conception and method of C ++ Class Library Design
  4. Several Methods for converting C ++ Language
  5. How to better compile C ++ code

Related Article

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.