"asm Macro" 是标准 C 的一部分吗?
Is an "asm Macro" part of standard C?
我们为嵌入式 PowerPC 架构开发代码。
我们的编译器支持称为 asm 宏的东西。
这里是手册的摘录:
asm Macro Syntax
An asm macro definition looks much like a function definition, including a return type and parameter list, and function body.
The syntax is:
asm [volatile] [return-type] macro-name ( [ parameter-list ] )
{
% storage-mode-list (must start in column 1)
! register-list (“!” must be first non-whitespace)
asm-code
} (must start in column 1
这是标准的C吗?我的编译器没有在他的手册中将此列为扩展。
第一次回答后的澄清:
我知道 { }
部分不是由标准 C 定义的。我的意思是在 asm
之后和结束 )
.[=16= 之前构造的函数]
不,它不是标准的 C。任何特定于体系结构的东西,如汇编代码,根据定义都将成为特定于实现的扩展。
asm
关键字在 C 中不是标准的,它在 C++ 中保留,但在这两种情况下,语法都是特定于实现的,如 here:
所述
asm-declaration gives the ability to embed assembly language source code within a C++ program. This declaration is conditionally-supported and implementation defined, meaning that it may not be present and, even when provided by the implementation, it does not have a fixed meaning.
它用于定义宏对我来说是新的,但是很有趣。
我们为嵌入式 PowerPC 架构开发代码。
我们的编译器支持称为 asm 宏的东西。
这里是手册的摘录:
asm Macro Syntax
An asm macro definition looks much like a function definition, including a return type and parameter list, and function body.
The syntax is:
asm [volatile] [return-type] macro-name ( [ parameter-list ] ) { % storage-mode-list (must start in column 1) ! register-list (“!” must be first non-whitespace) asm-code } (must start in column 1
这是标准的C吗?我的编译器没有在他的手册中将此列为扩展。
第一次回答后的澄清:
我知道 { }
部分不是由标准 C 定义的。我的意思是在 asm
之后和结束 )
.[=16= 之前构造的函数]
不,它不是标准的 C。任何特定于体系结构的东西,如汇编代码,根据定义都将成为特定于实现的扩展。
asm
关键字在 C 中不是标准的,它在 C++ 中保留,但在这两种情况下,语法都是特定于实现的,如 here:
asm-declaration gives the ability to embed assembly language source code within a C++ program. This declaration is conditionally-supported and implementation defined, meaning that it may not be present and, even when provided by the implementation, it does not have a fixed meaning.
它用于定义宏对我来说是新的,但是很有趣。