A curiosity about the VS2010 text editor

Given the A.h file below (note that on purpose, I didn't include the <iostream> header in this file). The VS2010 text editor then shows a red line below std, as it doesn't recognize this name.

class A
{
    public;
    A() throw(std::bad_alloc);
};

But if I include the <iostream> header in the A.cpp file as below, the red line disappears in the A.h file, even when the A.cpp is closed. How is this possible ?

#include <iostream>
#include "A.h"
A::A() { throw std::bad_alloc(); }

Answers


Add a new C++ file that does include A.h but doesn't include <iostream>. The red underline under std will reappear.

VS2010 knows which files include that header file. If any of them do not know about std, it will point out the issue.

But you're right, if you switch the order of the includes so that the project won't compile, it still removes the red underline.


Need Your Help

RethinkDB: get a document by key-value pair?

javascript node.js rethinkdb

I'm evaluating RethinkDB as a Mongo replacement due to lack of stable Mongo drivers on Node. I've read the docs at http://www.rethinkdb.com/api/javascript/get_all/ and have a very simple question: ...

How would you handle users who don't read dialog boxes?

user-interface dialog

A recent article on Ars Technica discusses a recent study performed by the Psychology Department of North Carolina State University, that showed users have a tendency to do whatever it takes to get...