Sun WorkShop Compiler C 5.0 User's Guide

asm Keyword

The _asm keyword is a synonym for the asm keyword. asm is available under all compilation modes, although a warning is issued when it is used under the -Xc mode.

The asm statement has the form:


asm("string"):

where string is a valid assembly language statement.

For example:


main()
{
	int i;

	/* i = 10 */
	asm("mov 10,%l0");
	asm("st  %l0,[%fp-8]");

	printf("i = %d\n",i);
}
% cc foo.c
% a.out
i = 10
%

asm statements must appear within function bodies.