Namespaces
Variants
Views
Actions

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 multiplies eax by 4 and adds it to eax --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:

  1. attribute-specifier-seq (optional) was added in (C++17), not (C++11).
  2. balanced-token-seq replaced string-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.

Best regards, Benio (talk) 20:45, 13 August 2024 (PDT)

I'm fine with marking the balanced-token-seq change as C++26, but the attributes are added by CWG 2262, which is supposed to be applied retroactively. See the cpp/language/asm#Defect reports section. --D41D8CD98F (talk) 06:02, 14 August 2024 (PDT)