4 ms·
Making their preprocessor compliant with (modern) C and C++ standards is on their roadmap though (and two-phase lookup is too): http://blogs.msdn.com/b/somaseg
by cremno 11y ago
Making their preprocessor compliant with (modern) C and C++ standards is on their roadmap though (and two-phase lookup is too):
http://blogs.msdn.com/b/somasegar/archive/2014/06/03/first-preview-of-visual-studio-quot-14-quot-available-now.aspx http://blogs.msdn.com/b/somasegar/archive/2014/06/03/first-p...
Also (nowadays) MS admits that their implementation of __VA_ARGS__ isn't compliant:
https://connect.microsoft.com/VisualStudio/Feedback/Details/1029464 https://connect.microsoft.com/VisualStudio/Feedback/Details/...
- userbinator 11y agoI'm not a big C++ user, nor terribly fond of the language in any case, but IMHO the "single-phase lookup" MSVC is doing for templates is conceptually much simpler to understand (and apparently implement) than the standard 2-phase: instantiating a template is literally a textual substitution, which is intuitively what I'd expect and understand templates to be.
- Kristine1975 11y agoWith two-phase lookup errors in code that does not depend on template arguments are caught earlier (when the template is defined) than with one-phase lookup (when the template is instanciated). Which is why template code written for Visual Studio might not compile with a standard conforming compiler. >instantiating a template is literally a textual substitution I'm being pedantic here, but that's not quite the case. Example: template <typename T> void foo() { T t; ... } foo<int[2]>(); With simple textual substitution this would result in a syntax error, as int[2] t; isn't valid C++ code.