From mint-bounce@lists.fishpool.fi Sun May 24 17:08:23 2009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4Mvk6SK/mr15xcIFUg6jUQXQ267dD1451WG3ZkxfwdA=; b=ewyavDlLRyNQ4VeT9jq698wlWV3ywrXtMwxUDKKTcrRX6i/FR3l6b/szm4TvjbIS70 qSw+KG400s5Be4hpwYl2O50QKnmUFGjQC9CgUdl/m4q0bNgb6bPUe90kpAZog7IL7AeQ CdRAAGpkrF8nawXwv6AIxmRJP9XeVKlZ5of2w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=cpaHN/0YvF5Oy6gZG6z6vxwU07s+iXe9j9UkzMjrHy0UHYTbE59ZRSQ+r0PYf3mXXu bDLSNZTWNXVh8ll90sxIUOyl962eDVfLKtYvvnW23NsEnQMqpNJ8ZP8TdTN0+U9eAm/n Psn2wzpvUM7ztMu6c3eS2PgGGUS0XNOInbtP4= MIME-Version: 1.0 In-Reply-To: References: Date: Sun, 24 May 2009 22:06:19 +0100 Message-ID: Subject: Re: [MiNT] anonymous structs and C99 From: Mariusz Buras To: Miro Kropacek Cc: "[MiNT] Mailing-List" Content-Type: text/plain; charset=windows-1252 X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: mariusz.buras@gmail.com Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.sparemint.org id n4OL8NLe015912 Did you tried giving a name to that union ? like: struct xxx { int x; int y; union myUnionName { char* pointer1; int* pointer2; }; } a; Greetings/Pozdrawiam, M.Buras 2009/5/24 Miro Kropacek : > Okay, this isn't exactly Atari/MiNT related question but I came to this > while coding on Atari :) And since there is plenty of skilled people... > > This: > > struct xxx > { >   int x; >   int y; >   union >   { >     char* pointer1; >     int* pointer2; >   }; > } a; > > compiles just fine with gcc. But as soon as I switch to -std=c99 mode, > compiler complains: error: ‘struct xxx’ has no member named ‘pointer1’. From > what I know, C99 standard says anonymous structs should be allocated on > stack but I don't see how it relates to this problem... > > Is there any workaround for this? I like this anonymous union because it > makes access to various pointers easier (I don't have to use void* and then > cast it) and it has always the same size (char*, int*, short* -- everything > pointers). > > Any hint appreciated :) > > -- > MiKRO / Mystic Bytes > http://mikro.atari.org >