开发者

Microsoft C++ Language Reference

Whenever any question is asked, and a referenc开发者_高级运维e text is needed, I never see MSDN C++ Language Reference being referred.

I was browsing through it and I personally feel that it is extremely well written.

Is there some specific reason it is not used as often as a standard?

Is it because it contains some VC++ specific features?


I believe it's because those of us referencing a reference reference the actual standard itself.


The answer is fairly simple: The MSDN reference is not authoritative. It tells you how Microsoft's compiler behaves, and yes, it usually happens to coincide with what the standard says. But when someone asks how the C++ language deals with some situation, only one text has any authority: the ISO standard.

So when answering questions about C++, people tend to reference the standard. If you ask specifically about how MSVC implements it, then MSDN would be a perfectly valid source. But most questions are simply about C++.

Or to put it another way: if MSDN contains a typo, then MSDN is wrong. If the ISO standard contains a typo, then that's how the language is defined.


MS has been pretty good about making clear which parts of the document are MS specific or not, so I agree that the MS references are pretty good (particularly if you're interested in MS extensions).

I generally refer to the standards docs if I'm looking for information about "what's standard" because:

  1. I have them (see Where do I find the current C or C++ standard documents? for links to how to get yours)
  2. they're PDFs which I find easier to search and read than the web-based or Windows Help-based MSDN docs
  3. they're definitive (as far as answering questions about the standard)

The biggest drawback is that I don't have an electronic version of the C90 standard, yet..


Is it because it contains some VC++ specific features?

I think that's the basic reason. For example, it often contains info on C++/CLI, not just C++.

VC++ 2010 reference, I think, is careful in distinguishing which part is in the C++ proper and which part is in the C++/CLI. But to refer to the standard, of course it's better to refer to the standard itself. VC++ documentation refers to the standard quite often, too.


One interesting example: just look at all those __XXX keywords!! (The C++ standard has none)


The C++ Standard defines how the C++ language works, the Microsoft C++ Language Reference defines how Microsoft's implementation of that language works.

So if you want to know what behavior is guaranteed independent of the compiler, The Standard is your guide. Some details and certain corner cases are left to be implementation-defined there and every implementation can define extensions to the language, so if you want to use those MSCV specific properties Microsoft's Language Reference should explain them.

Most SO questions on C++ on don't explicitly ask for a MSVC specific answer that might not be true for other compilers. So referring to The Standard gives an general, compiler independent answer, while the MS Language Reference wouldn't hold much weight for anything else than MSVC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜