delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/26/08:55:40

From: "Homer Simpson" <homer DOT simpson AT springfield DOT com>
Newsgroups: comp.os.msdos.djgpp,comp.lang.c
Subject: Re: How do I initialize a union?
Date: Sun, 26 Sep 1999 13:10:40 +0200
Organization: Cybercable Paris NewsServer
Message-ID: <7skuvi$cs$1@oceanite.cybercable.fr>
References: <7secmg$8nd$1 AT solomon DOT cs DOT rose-hulman DOT edu>
NNTP-Posting-Host: d025.paris-107.cybercable.fr
Mime-Version: 1.0
X-Trace: oceanite.cybercable.fr 938344242 412 212.198.107.25 (26 Sep 1999 11:10:42 GMT)
X-Complaints-To: usenet AT oceanite DOT cybercable DOT fr
NNTP-Posting-Date: 26 Sep 1999 11:10:42 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Lines: 41
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Damian Yerrick a écrit dans le message
<7secmg$8nd$1 AT solomon DOT cs DOT rose-hulman DOT edu>...
>/*
>I'm using DJGPP (the DOS version of the C compiler GCC).
>How do I initialize a union?
>*/
>
>typedef union Boxers
>{
>  short left, right;
>} Boxers;


Do you *really* need to declare "Boxers" twice ? Once is enough.
Multiple declaration on one line is syntactitally correct (oops... more than
my English I presume), but unfair for comments :

typedef union
{
  short left; /* smart functional comment for 'left' */
  short right; /* smart functional comment for 'right' */
} Boxers;

>typedef union Foo
>{
>  void *data;
>  Boxers trunks;
>} Foo;
>
>Foo bar;
>
>How do I set up a declaration that defines an initial value for
>bar.data or bar.trunks?


A response has been given previoulsy by Erick
--
HS



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019