Talk:cpp/language/asm
From cppreference.com
The example code on this page does not work. There is no multiplication written there, so the intended output will not happen, and the program segfaults when run. Will eccles (talk) 07:39, 6 July 2021 (PDT)
- It runs fine and gives the output as expected, as can be seen by using the "run this code" button. The multiplication by 5 comes from the
lea
, which multiplieseax
by 4 and adds it toeax
--Ybab321 (talk) 13:04, 6 July 2021 (PDT)
Wrong Syntax
According to:
- C++26 standard (ISO/IEC 14882:2026):
- 9.10 The asm declaration [dcl.asm]
- C++23 standard (ISO/IEC 14882:2024):
- 9.10 The asm declaration [dcl.asm]
- C++20 standard (ISO/IEC 14882:2020):
- 9.10 The asm declaration [dcl.asm]
- C++17 standard (ISO/IEC 14882:2017):
- 10.4 The asm declaration [dcl.asm]
- C++14 standard (ISO/IEC 14882:2014):
- 7.4 The asm declaration [dcl.asm]
- C++11 standard (ISO/IEC 14882:2011):
- 7.4 The asm declaration [dcl.asm]
- C++03 standard (ISO/IEC 14882:2003):
- 7.4 The asm declaration [dcl.asm]
- C++98 standard (ISO/IEC 14882:1998):
- 7.4 The asm declaration [dcl.asm]
the syntax before diff. 174910 was wrong:
-
attribute-specifier-seq
(optional) was added in (C++17), not (C++11). -
balanced-token-seq
replacedstring-literal
in (C++26), while old page stated wrongly that is was there since beginning.
I've corrected the Syntax section, but sections: Explanation and Notes should be corrected aswell.