开发者

C++0x legacy code problem [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

As all you know, C++0x 开发者_开发问答can't bring lots of important changes because of legacy code: all legacy code (including C code) can be compilable with a C++0x compiler.

So why don't add something like #pragma syntax(language_version), which will allow new syntax with breaking changes?

#include <legacy_code_header.h>

#pragma syntax(2098)

// something strange
func(x)
{
   return x + 1, x * 2;
}

int main()
{
   a, b = func(1.0);
   return a + b;
}


Some C++0x compilers might allow this. After all, #pragmas are generally compiler specific and not dictated by the standard. Others support this with command line options.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜