Explorar o código

add old-style "for" scoping workaround by Vesa Karvonen

[SVN r12375]
Jens Maurer %!s(int64=24) %!d(string=hai) anos
pai
achega
1858f24020
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      more/microsoft_vcpp.html

+ 11 - 0
more/microsoft_vcpp.html

@@ -126,6 +126,17 @@ int main()
 
 <strong>Workaround:</strong> Enclose the offending <code>for</code>
 loops in another pair of curly braces.
+<p>
+Another possible workaround (brought to my attention by Vesa Karvonen)
+is this:
+<pre>
+#ifndef for
+#define for if (0) {} else for
+#endif
+</pre>
+
+Note that platform-specific inline functions in included headers might
+depend on the old-style <code>for</code> scoping.
 
 
 <h3>[inclass-member-init] In-class member initialization</h3>

粤ICP备19079148号