www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/31/19:31:47

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: unions, help!
Date: Tue, 31 Mar 1998 19:04:23 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 46
Message-ID: <35218487.10CA@cs.com>
References: <35217A4D DOT 17B0 AT wwc DOT edu>
NNTP-Posting-Host: ppp225.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jack Carico wrote:
> 
> I am learning C and when I try to compile this example program through
> RHIDE I get the message "there were some errors". DJGPP seems to do this
> for any program that attempts to define a union.
> 
> (example.c)
> 
> #include <stdio.h>
> 
> int main()
> {
>  union share
>  {
>   int i_face;
>   char c_face[8];
>  };
> 
>  union share jec_hyd;
>  printf("%d\n",sizeof(jec_hyd));
>  return(0);
> }

Compiling the above program from DOS under the name 'union.c' produced
the following results:

[WIN] D:\TEMP>gcc -Wall -O -g -o union.exe union.c
union.c: In function `main':
union.c:13: warning: int format, long int arg (arg 2)
[WIN] D:\TEMP>union
8

The warning is not major (you should specify "%ld" to display size_t
values), so the only thing I can think of is that your RHIDE or DJGPP
configuration is messed up somehow.  Can you compile these programs from
MS-DOS?  If so, what does gcc report?

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>  UIN# 7406319

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


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