Compiler Warnings with STL Map Containers

Question:

Using even the most basic default constructor, such as ” mapm; ” , causes a debug error creating huge compiler warnings in Visual C++ and MS Visual Studio 6.0. That one line alone causes 6 warnings and the small sample program below ultimately creates a total of 19 warnings. The code executes without further incident but the unresolved warnings trouble me. In essence, the compiler warnings indicate that the debugger continues to append class names into long command lines that eventually exceed the 255-character limitation. The suggested resolution, substituting a 1-character name for the class name during debug time, does not work. Is there a fix?

#include #include #include using namespace std;class classic  {	 long account;	 char descrip[50];  public:	 classic (); 	 classic (int yr, char *who_or_what);	~classic (); 	 void show_list (); 	 int  get_val () const;	 bool target (int low, int hi);	 friend ostream &operator<< (ostream &stream, classic item);};classic::classic ()	 {	cout << "default constructor" << endl; }classic::classic (int acct, char *who_or_what)  { 	account = acct; 	strcpy(descrip, who_or_what);	cout << "overloaded constructor" << endl; }classic::~classic ()  { 	cout << "destructor" << endl; }int classic:: get_val() const {	return account;}void classic::show_list ()  {	cout << "- " << account << " "<< descrip << endl;  }bool classic::target (int low, int hi)  { 	return (account >= low && account <= hi); }ostream &operator<< (ostream &stream, classic item)  { 	stream << " - " << item.account << " " << item.descrip << endl;	return stream;  }// -------------  Non-member Operator Functions for the Class  -------------//bool operator< (const classic &item1, const classic &item2)  {	return item1.get_val() < item2.get_val();}bool operator> (const classic &item1, const classic &item2)  {	return item1.get_val() > item2.get_val();}bool operator== (const classic &item1, const classic &item2)  {	return item1.get_val() == item2.get_val();}bool operator!= (const classic &item1, const classic &item2)  {	return item1.get_val() != item2.get_val();}// --------------------------//int main(){		int accts = 0;	cout << "** INITIALIZING MAP CONTAINER **" << endl;		map line;		//  Fill the map	line.insert( pair( long(10000), classic(10000, "Sandal Accounts")) );	line.insert( pair( long(10500), classic(10500, "Slipper Accounts")) );	line.insert( pair( long(21000), classic(21000, "Women's Shoe Accounts")) );	line.insert( pair( long(31000), classic(31000, "Men's Shoe Accounts")) );	line.insert( pair( long(50500), classic(50500, "Boot Accounts")) );		//  Display map data	map::iterator p;	accts = line.size();	cout << endl << "Map accounts = " << accts << ", max map accounts posible is " 				 << line.max_size() << ". " << endl << endl;	cout <<	"The first map cell with account data is: " << endl << '	'; 	line.lower_bound(1)	-> second.show_list();	cout << endl;	cout <<	"The final map cell withh account data is " << endl << '	'; 	line.rbegin() -> second.show_list();	cout << endl;	cout << "FOOTWEAR of many styles and types ";	if (line.count(10000))		cout << "including sandals ";	cout << endl << '	';	if (line.count(90000))		cout << "and other great stuff. " << endl;	else		cout << "and, yes, we have no miscellaneous. " << endl;	// Display the full map	cout << endl << "MAP CONTENTS OF "<< accts << " INVENTORY ACCOUNTS" << endl;		p = line.begin();	while (p != line.end() )  	{		p -> second.show_list();		p++;	}	return 0;}

Answer:

You shouldn’t pick very short names for your identifiers, this isn’t the cause of your problem, and therefore, it will not hush these warnings. These warnings result from a debugger shortcoming, which will be fixed in the next Visual C++ release, hopefully. As always, use meaningful names for identifiers.

This warning message occurs frequently when using templates, and STL containers in particular. Essentially, it says that the debugger cannot display the symbolic names of the functions in the template classes because they exceed the 255 character limit. You can safely ignore this warning. When you build a release version of your app, these warnings will disappear.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

Top 5 B2B SaaS Marketing Agencies for 2023

In recent years, the software-as-a-service (SaaS) sector has experienced exponential growth as more and more companies choose cloud-based solutions. Any SaaS company hoping to stay ahead of the curve in this quickly changing industry needs to invest in effective marketing. So selecting the best marketing agency can mean the difference

technology leadership

Why the World Needs More Technology Leadership

As a fact, technology has touched every single aspect of our lives. And there are some technology giants in today’s world which have been frequently opined to have a strong influence on recent overall technological influence. Moreover, those tech giants have popular technology leaders leading the companies toward achieving greatness.

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.