From mint-bounce@lists.fishpool.fi Sun May 24 17:30:33 2009 Message-ID: <4A19BBD3.8060409@freesbee.fr> Date: Sun, 24 May 2009 23:27:47 +0200 From: =?windows-1252?Q?Vincent_Rivi=E8re?= User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: "[MiNT] Mailing-List" CC: Miro Kropacek Subject: Re: [MiNT] anonymous structs and C99 References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed X-Antivirus: avast! (VPS 090524-0, 24/05/2009), Outbound message X-Antivirus-Status: Clean X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: vincent.riviere@freesbee.fr 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 n4OLUW2l020378 Hello. That kind of syntax is a Microsoft extension ;-) You can use it along with -std=c99 if you add -fms-extensions Well, if you want to be standard compliant, it is not a good idea. You should have noticed the warning : a.c:52: warning: declaration does not declare anything In C99, your union is only a new type, but it is unused since you didn't declare a variable. The solution is: struct xxx { int x; int y; union { char* pointer1; int* pointer2; } u; // HERE } a; Then you can use a.u.pointer1 Of course, no cast is required ! -- Vincent Rivière