Reputation: 15175
We develop code for embedded PowerPC architectures.
Our compiler supports something called asm Macros.
Here an excerpt from the handbook:
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
Is this standard C? My compiler does not list this as an extension in his handbook.
Clarification after first answer:
I'm aware the part withen { }
is not defined by standard C. I meant the function like construct after asm
and before the closing )
.
Upvotes: 3
Views: 536
Reputation: 93534
The asm
keyword is not standard in C, it is reserved in C++, but in both cases the the syntax is implementation specific as described 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.
It's use to define a macro is new to me and interesting however.
Upvotes: 0
Reputation: 225042
No, it is not standard C. Anything architecture-specific, like assembly code, is going to be an implementation-specific extension just about by definition.
Upvotes: 4