From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 References: In-Reply-To: From: Kyohei Kadota Date: Tue, 2 Apr 2019 23:44:18 +0900 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] Don't Plan 9 C compiler initialize the rest of member of a struct? Topicbox-Message-UUID: f81aa6b4-ead9-11e9-9d60-3106f5b1d025 I ran this code on 386 machine on QEMU based public VPC service. 2019=E5=B9=B44=E6=9C=882=E6=97=A5(=E7=81=AB) 9:27 Skip Tavakkolian : > > It should initialize to zero. 8c and 5c both do the right thing here. > > Which distribution and cputype? > > On Mon, Apr 1, 2019, 8:34 AM Kyohei Kadota wrote: >> >> Hi, 9fans. I use 9legacy. >> >> About below program, I expected that flags field will initialize to >> zero but the value of flags was a garbage, ex, "f8f7". >> Is this expected? >> >> ``` >> #include >> >> struct option { >> int n; >> char *s; >> int flags; >> }; >> >> int >> main(void) >> { >> struct option opt =3D {1, "test"}; >> printf("%d %s %x\n", opt.n, opt.s, opt.flags); >> return 0; >> } >> ``` >>