リスト22 リスト23


〔リスト22〕構造体の配列を初期化する例(test60.c)
	#include <stdio.h>
	struct CD_data1 
	{ 
	char title[255];
	char name[255];
	char memo[255];
	int Purchase_price;
	};
	struct CD_data2 
	{ 
	char title[255];
	char name[255];
	char memo[255];
	int Purchase_price;
	};
	struct CD_data3 
	{ 
	char title[255];
	char name[255];
	char memo[255];
	int Purchase_price;
	};
	int main(void)
	{
	 struct CD_data1 mydata1 = {"hogehoge","hoge","(T_T)...",3000};
	 struct CD_data2 mydata2 = {name:"hoge",memo:"(T_T)...",Purchase_price:3000,title:"hogehoge"};
	 struct CD_data3 mydata3 = {.memo="(T_T)...",.Purchase_price=3000,title:"hogehoge",name:"hoge"};
	 return;
	}


〔リスト23〕test60.cから生成されたアセンブラ(test60.s)
	 .file "test60.c"
	 .version "01.01"
	gcc2_compiled.:
	.section .rodata
	 .align 4
	.LC0:
	 .string "hogehoge"
	 .zero 246
	 .string "hoge"
	 .zero 250
	 .string "memomemo"
	 .zero 246
	 .zero 3
	 .long 3000
	 .align 4
	.LC1:
	 .string "hogehoge"
	 .zero 246
	 .string "hoge"
	 .zero 250
	 .string "memomemo"
	 .zero 246
	 .zero 3
	 .long 3000
	 .align 4
	.LC2:
	 .string "hogehoge"
	 .zero 246
	 .string "hoge"
	 .zero 250
	 .string "memomemo"
	 .zero 246
	 .zero 3
	 .long 3000
	.text
	 .align 4
	.globl main
	 .type  main,@function
	main:
	 pushl %ebp
	 movl %esp,%ebp
	 subl $2336,%esp
	 pushl %edi
	 pushl %esi
	 leal -772(%ebp),%edi
	 movl $.LC0,%esi
	 cld
	 movl $193,%ecx
	 rep
	 movsl
	 leal -1544(%ebp),%edi
	 movl $.LC1,%esi
	 cld
	 movl $193,%ecx
	 rep
	 movsl
	 leal -2316(%ebp),%edi
	 movl $.LC2,%esi
	 cld
	 movl $193,%ecx
	 rep
	 movsl
	 popl %esi
	 popl %edi
	 movl %ebp,%esp
	 popl %ebp
	 ret
	.Lfe1:
	 .size  main,.Lfe1-main
	 .ident "GCC: (GNU) 2.95.3 20010315 (release)"