[Experience Summary] how to remove compilation errors during STL code compilation in VC

Source: Internet
Author: User

 

From: http://bbs.jlu.edu.cn/cgi-bin/bbscon? Board = Algorithm & file = m.1058575913.a & num = 1
It is estimated that when you compile STL, it will be annoying to look at a bunch of meaningless warning messages. The header files that contain the following will make your eyes quiet, it is estimated that it will look very tired on the BBS, so I did not fold it, because the format would be broken, but it would be even worse. You should mail it back to see it, but the funny thing is that I used to look at the warnings and felt annoying, all of them have been deleted, and I think some warnings are also quite good. It is the compilation progress. Now, except for the final end, I don't know how much compilation has been done. Haha, I think I am quite abnormal.//////////////////////////////////////// /// // Author: oskar Wieland (oskar.wieland@gmx.de) // You Can modifiy and distribute this file freely. /// creation: 31.05.2000 // purpose: declarations for using STL without warning noise. /// usage: Include this file and define at least one of the stl_using_xxx // macros. currently supported data types from the STL: // define S for using the STL // # define attributes // # define stl_using_vector // # define stl_using_list // # define stl_using_string // # define stl_using_stream // # define attributes // # define stl_using_memory // # define stl_using_stack ///sample: // # define stl_using_all // # include "STL. H "////////////////////////////////////// //////////////////////////////////////// ////////////// //////////////////////////////////////// //// // Include guards ////////////////////////// //////////////////////////////////////// //// # ifndef stlhelper_included _ # define stlhelper_included _ # If _ msc_ver> 1000 # pragma once # endif ///////////////// //////////////////////////////////////// //// // handy define to include all stuff /////////////////// //////////////////////////////////////// /////// /// # Ifdef # define stl_using_vector # define sequence # define stl_using_string # define stl_using_stream # define sequence # define stl_using_stack # endif /////// //////////////////////////////////////// /// // STL neccessary Declaration for map ////////// //////////////////////////////////////// /// // # ifdef Stl_using_map # pragma warning (push) # include <yvals. h> // warning numbers get enabled in yvals. h # pragma warning (Disable: 4018) // signed/unsigned mismatch # pragma warning (Disable: 4100) // unreferenced formal parameter # pragma warning (Disable: 4245) // conversion from type1 to type2, signed/unsigned mismatch # pragma warning (Disable: 4512) // class: assignment operator cocould not be generated # pragma wa Rning (Disable: 4663) // C ++ language change: To explicitly specialize class template Vector # pragma warning (Disable: 4710) // function: function not inlined # pragma warning (Disable: 4786) // identifier was truncated to number characters in the debug information // BUG: c4786 warning is not disabled with # pragma warning/status: microsoft has confirmed this to be a bug in the Microsoft product. thi S warning can be ignored. // This occured only in the <map> container. # include <map> # pragma warning (POP) # endif ////////////////////////////////////// //// // STL neccessary Declaration for vector/ //////////////////////////////////////// /// // # ifdef stl_using_vector # pragma warning (push) # include <yvals. h> // warning numbers get enabled in yvals. h # pragma Warning (Disable: 4018) // signed/unsigned mismatch # pragma warning (Disable: 4100) // unreferenced formal parameter # pragma warning (Disable: 4245) // conversion from type1 to type2, signed/unsigned mismatch # pragma warning (Disable: 4663) // C ++ language change: To explicitly specialize class template Vector # pragma warning (Disable: 4702) // unreachable Code # pragma warning (Disable: 4710) // Function: Function not inlined # pragma warning (Disable: 4786) // identifier was truncated to number characters in the debug information # include <vector> # pragma warning (POP) # endif ////////////////////////////////////// //// // STL neccessary Declaration for list/ //////////////////////////////////////// /// // # ifdef stl_using_list # pragma warning (push) # include <Y Vals. h> // warning numbers get enabled in yvals. h # pragma warning (Disable: 4100) // unreferenced formal parameter # pragma warning (Disable: 4284) // return type for identifier :: operator-> is not a UDT or reference // to a UDT. will produce errors if applied using infix notation # pragma warning (Disable: 4710) // function: function not inlined # pragma warning (Disable: 4786) // identifier was truncated t O number characters in the debug information # include <list> # pragma warning (POP) # endif ////////////////////////////////////// //// // STL neccessary Declaration for string/ //////////////////////////////////////// /// // # ifdef stl_using_string # pragma warning (push) # include <yvals. h> // warning numbers get enabled in yvals. h # pragma warning (Disable: 4018) // Signed/unsigned mismatch # pragma warning (Disable: 4100) // unreferenced formal parameter # pragma warning (Disable: 4146) // unary minus operator applied to unsigned type, result still unsigned # pragma warning (Disable: 4244) // conversion from type1 to type2, possible loss of data # pragma warning (Disable: 4245) // conversion from type1 to type2, signed/unsigned mismatch # pragma warning (Di Sable: 4511) // class: copy constructor cocould not be generated # pragma warning (Disable: 4512) // class: assignment operator cocould not be generated # pragma warning (Disable: 4663) // C ++ language change: To explicitly specialize class template Vector # pragma warning (Disable: 4710) // function: function not inlined # pragma warning (Disable: 4786) // identifier was truncated to number characters in Debug information # include <string> # pragma warning (POP) # pragma warning (Disable: 4514) // unreferenced inline/local function has been removed # pragma warning (Disable: 4710) // function: function not inlined # pragma warning (Disable: 4786) // identifier was truncated to number characters in the debug information # endif ////////////////////////// //////////////////////////////////////// ///// STL necc.pdf Ry Declaration for streams //////////////////////////////////// /// // # ifdef stl_using_stream # pragma warning (push) # include <yvals. h> // warning numbers get enabled in yvals. h # pragma warning (Disable: 4097) // typedef-name identifier1 used as synonym for class-name identifier2 # pragma warning (Disable: 4127) // conditional expression is constant # include <sstream> # include <FS Tream> # pragma warning (POP) # endif ////////////////////////////////////// /// // STL neccessary Declaration for memory/ //////////////////////////////////////// /// // # ifdef stl_using_memory // the STL Library provides a type called auto_ptr for managing pointers. // This template class acts as a stack variable for dynamically allocated // memory. when Variable goes out of scope, its destructor gets called. // In its de-structor, it calldelete on the contained pointer, making sure // that the memory is returned to the heap. # pragma warning (push) # include <yvals. h> // warning numbers get enabled in yvals. h # pragma warning (Disable: 4018) // signed/unsigned mismatch # pragma warning (Disable: 4100) // unreferenced formal parameter # pragma warning (disable: 4245) // conversion from type1 to type2, signed/unsigned mismatch # pragma warning (Disable: 4710) // function: function not inlined # pragma warning (Disable: 4786) // identifier was truncated to number characters in the debug information # include <memory> # pragma warning (POP) # endif ////////////////////////////////////// //// // STL neccessary Declaration for Stack/ ////////// //////////////////////////////////////// /// // # Ifdef stl_using_stack # pragma warning (push) # include <yvals. h> // warning numbers get enabled in yvals. h # pragma warning (Disable: 4018) // signed/unsigned mismatch # pragma warning (Disable: 4100) // unreferenced formal parameter # pragma warning (Disable: 4245) // conversion from type1 to type2, signed/unsigned mismatch # pragma warning (Disable: 4 710) // function: function not inlined # pragma warning (Disable: 4786) // identifier was truncated to number characters in the debug information # include <stack> # pragma warning (POP) # endif ////////////////////////////////////// /// // STL neccessary Declaration for assert/ //////////////////////////////////////// /// // # ifdef stl_using_assert // avoid Mac RO redefinition when using MFC # ifndef assert # include <cassert> // macros for tracking down errors # ifdef _ debug # define assert (exp) # define verify (exp) assert (exp) # define trace: outputdebugstring # else # define assert (exp) (void) 0) # define verify (exp) (void) (exp )) # define trace 1? (Void) 0 ::: outputdebugstring # endif // _ debug # endif // assert // additional macros # define assert_break (exp) {assert (exp); If (! (Exp) Break ;}# define assert_continue (exp) {assert (exp); If (! (Exp) continue;} # define assert_return (exp) {assert (exp); If (! (Exp) return ;}# define assert_return_null (exp) {assert (exp); If (! (Exp) return 0 ;}# define assert_return_false (exp) {assert (exp); If (! (Exp) return false ;} # endif // stl_using_assert /////////////////////////////////// /// // verify proper use of macros ////////////////////////////////////// /// // # If defined stl_using_map | defined stl_using_vector | defined stl_using_list | defined stl_using_string | defined stl_using_stream | defined stl_using_assert | defined stl_us Ing_memory | defined stl_using_stackusing namespace STD; # else # pragma message ("Warning: You have ded <STL. h> without using any STL featur es! ") # Endif // stlhelper_included _

 

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.