Post

Microsoft's C++ Compiler, Don't Be So Fragile

A few days ago, I was writing code as usual. Save, Ctrl+Shift+B, and then…

1>Compiling…
1>cpd.cpp
1>d:\widgetengine\test\cpd\cpd.cpp(66) : fatal error C1001: Internal compiler error.
1>(Compiler file “d:\orcas\compiler\utc\src\P2\ehexcept.c”, line 971)
1> To work around this problem, try simplifying or changing the program near the locations listed above.

Sigh, is my code really that twisted? I don’t think so. If there’s a syntax error, just tell me — no need to crash and burn…

Bring out the culprit code that killed the VS2008 C++ compiler!

typedef struct _keyidmap
{
int nKeyCode;
CString strDesc;
}KeyMap;

KeyMap keyIdentifierMap[] =
{
{VK_LEFT, L”Left”},
{VK_RIGHT, L”Right”},
NULL,
};

Create a random MFC project, write this code at global scope, build — the compiler will definitely crash…

This post is licensed under CC BY 4.0 by the author.