五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

typedef example

2021-10-18 22:00 作者:晨夕星海  | 我要投稿


#include <stdio.h>

int main(){
	int a=1;
	int b=15;
 	int c=a+b;
}

用一下命令編譯成.s,其中“-S”用于指定僅編譯,“-O0”用于阻止編譯器代碼優(yōu)化

gcc -S -O0 -o a.s a.c

結(jié)果如下:

	.file	"a.c"
	.text
	.def	__main;	.scl	2;	.type	32;	.endef
	.globl	main
	.def	main;	.scl	2;	.type	32;	.endef
	.seh_proc	main
main:
	pushq	%rbp
	.seh_pushreg	%rbp
	movq	%rsp, %rbp
	.seh_setframe	%rbp, 0
	subq	$48, %rsp
	.seh_stackalloc	48
	.seh_endprologue
	call	__main
	movl	$1, -4(%rbp)
	movl	$15, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	$0, %eax
	addq	$48, %rsp
	popq	%rbp
	ret
	.seh_endproc
	.ident	"GCC: (GNU) 9.2.0"

使用typedef的版本:

#include <stdio.h>

typedef int Intenger;

int main(){
	Intenger a=1;
	Intenger b=15;
 	Intenger c=a+b;
}

編譯:

gcc -S -O0 -o b.s b.c

結(jié)果:

	.file	"b.c"
	.text
	.def	__main;	.scl	2;	.type	32;	.endef
	.globl	main
	.def	main;	.scl	2;	.type	32;	.endef
	.seh_proc	main
main:
	pushq	%rbp
	.seh_pushreg	%rbp
	movq	%rsp, %rbp
	.seh_setframe	%rbp, 0
	subq	$48, %rsp
	.seh_stackalloc	48
	.seh_endprologue
	call	__main
	movl	$1, -4(%rbp)
	movl	$15, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	$0, %eax
	addq	$48, %rsp
	popq	%rbp
	ret
	.seh_endproc
	.ident	"GCC: (GNU) 9.2.0"

用Windows的fc命令對比兩次結(jié)果:

>fc a.s b.s
正在比較文件 a.s 和 B.S
***** a.s
 ? ? ? ?.file ? "a.c"
 ? ? ? ?.text
***** B.S
 ? ? ? ?.file ? "b.c"
 ? ? ? ?.text
*****

除了文件名,沒有任何不同,typedef并不會影響匯編代碼

typedef example的評論 (共 條)

分享到微博請遵守國家法律
防城港市| 平定县| 谷城县| 绵阳市| 布拖县| 习水县| 沂源县| 大方县| 沁阳市| 凤冈县| 唐海县| 八宿县| 三台县| 凤阳县| 鹤庆县| 荆门市| 新宾| 秀山| 梁平县| 邳州市| 响水县| 曲阳县| 贡山| 滨州市| 革吉县| 南安市| 明水县| 安新县| 崇文区| 龙南县| 安平县| 成武县| 旬阳县| 林口县| 石泉县| 布拖县| 襄樊市| 广德县| 张掖市| 彰武县| 泰顺县|