C++0x legacy code problem [closed]
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.
精彩评论