8

Whenever any question is asked, and a reference 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?

Lazer
  • 90,700
  • 113
  • 281
  • 364
  • close-voter: does it help if this is made a community wiki? – Lazer Apr 13 '10 at 21:27
  • 1
    It's not a close vote, it's a Migrate to Meta vote. – Billy ONeal Apr 13 '10 at 21:28
  • I'm guessing the majority of the C++ tag audience at SO doesn't use MSVC as their first choice. There's a strong GCC presence, many OPs assume it. They won't put much stake in a company reference. It certainly doesn't cover the same ground as the official language reference. There's little point. – Hans Passant Apr 13 '10 at 22:34
  • 1
    @Hans Passant: I disagree. Until G++ (actually MinGW) can effectively support Unicode on Windows, most Windows programmers will continue to avoid it. And considering Windows is 90+% of the consumer application market, assuming G++ is probably not the reason here. G++ is an **excellent** compiler for Unixen and friends, but I'd not think of using it on Windows until Unicode is implemented. – Billy ONeal Apr 14 '10 at 00:13
  • 4
    Why are people voting to move this to meta? It's a question about C++ and about reference texts for the language. – jalf Apr 14 '10 at 02:14
  • @Jalf: Because as written it's not a question about which C++ reference to use, it's "Why are people on SO doing this"? Such questions belong on meta. – Billy ONeal Apr 14 '10 at 02:31
  • 1
    @Billy ONeal and the answers compare the merits of different C++ reference sources, so then the question would need migration back to SO? – Laurynas Biveinis Apr 14 '10 at 07:06
  • @Laurynas Biveinis: I don't know. I was just explaining why I voted to migrate it. I voted before answers were posted, however. – Billy ONeal Apr 14 '10 at 07:18
  • 2
    @Billy: NO it doesn't. People on SO do this because of C++ reasons, not because of SO policy reasons. I see how someone who doesn't understand the question might think that it's about SO policy and so belongs on meta. But the question (and the correct answer) are to do with C++ and nothing else. The *reason* he asks is just an observation made on SO. – jalf Apr 14 '10 at 10:12
  • 1
    The question is back on SO after a short and thrilling excursion in Meta. – Daniel Daranas Apr 14 '10 at 16:14
  • 2
    @Billy: As written, it is a question of why people on SO prefer one reference over the other. But he's not asking about SO policy, he's asking because SO is where he observed the phenomenon. If he'd said that he'd noticed on gamedev.net that people tended to refer to the ISO standard over MSDN, would you then say it was a question about game programming rather than about C++? Of course not. He is asking why the C++ experts on SO answer C++ questions the way they do. And the answer is grounded in C++, and nothing else. It is a C++ question and nothing else. – jalf Apr 14 '10 at 23:05

6 Answers6

8

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

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
  • Although the actual standard is not on line but drafts of the current and next one are – mmmmmm Apr 13 '10 at 21:29
  • 4
    This. If you want a definitive source on C++, use ISO 14882:2003. MSDN may be reliable, or it may not, but it's not authoritative. – Derrick Turk Apr 13 '10 at 21:31
  • @Derrick Turk: this ISO 14882:2003 C++ standard is not free of cost! I didn't expect this. – Lazer Apr 13 '10 at 21:41
  • 2
    @eSKay: true. It's fairly cheap though, I think $18 from ANSI (or $30, can't remember, got mine through work). FYI the drafts are available for free from open-std.org and the draft immediately prior to adoption of the '03 standard should be Pretty Darn Close (tm). – Derrick Turk Apr 13 '10 at 21:52
  • Links to various standard documents: http://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents/83763#83763 – Michael Burr Apr 13 '10 at 22:04
4

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.

jalf
  • 243,077
  • 51
  • 345
  • 550
2

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.

Kev
  • 118,037
  • 53
  • 300
  • 385
Yuji
  • 34,103
  • 3
  • 70
  • 88
2

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..

Community
  • 1
  • 1
Michael Burr
  • 333,147
  • 50
  • 533
  • 760
0

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

Rooke
  • 2,013
  • 3
  • 22
  • 34
  • @Rooke: hmm... confusing. Though the page does say `Names with leading underscores are Microsoft extensions.` on top. – Lazer Apr 13 '10 at 21:38
  • 2
    That's because the standard reserves them for implementers... (_xyz and __xyz) – conio Apr 13 '10 at 21:42
  • @conio: _xyz is only reserved at the global namespace. – Dennis Zickefoose Apr 13 '10 at 22:29
  • 1
    @Dennis: if you want to be precise (also known as "nitpicking"), they are reserved in both the global namespace and ::std namespace, unless the first letter following the underscore is a capital letter - in that case they are reserved everywhere (§17.4.3.1.2). In any case, Rooke mentioned keywords beginning with two underscores, and those are reserved everywhere always. – conio Apr 13 '10 at 23:59
  • And just for kicks, [IBM keywords](http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr126.htm), [Sun C++ documentation](http://dlc.sun.com/pdf/820-7599/820-7599.pdf) (you'll have to search the PDF for underscores), [Intel C++ for Windows keywords](http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/cpp/win/compiler_c/cref_cls/common/cppref_keyword_overview.htm), and so on... – conio Apr 14 '10 at 09:57
0

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.

sth
  • 222,467
  • 53
  • 283
  • 367