RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: Beginner
Dec 16, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Compiler Warnings with STL Map Containers


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?

using namespace std;

class classic  {
	 long account;
	 char descrip[50];
	 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 << '\t'; 
	line.lower_bound(1)	-> second.show_list();
	cout << endl;

	cout <<	"The final map cell withh account data is " << endl << '\t'; 
	line.rbegin() -> second.show_list();
	cout << endl;

	cout << "FOOTWEAR of many styles and types ";
	if (line.count(10000))
		cout << "including sandals ";

	cout << endl << '\t';
	if (line.count(90000))
		cout << "and other great stuff. " << endl;
		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();
	return 0;


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.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date