Article View: comp.std.c
Article #5426Re: structure assignment in dpANSI
From: Doug Gwyn
Date: Thu, 10 Nov 1988 17:20
Date: Thu, 10 Nov 1988 17:20
15 lines
1056 bytes
1056 bytes
In article <11077@elroy.Jpl.Nasa.Gov> djb@spacely.Jpl.Nasa.Gov (Daniel J. Burns) writes:
>The definition of compatible types for structures is unclear to me.
>Is the following legal?
> struct { int x ; float y ; } a ;
> struct { int x ; float y ; } b ;
> a = b ; /* ??? */
Assuming that a and b are declared in the same translation unit,
they have different types and are not compatible. (If they were
declared in separate translation units, they would have different
but compatible types.)
Therefore if you need for something along the above lines to work,
you should use struct tag or a typedef in place of a struct{...}
style of declaration.
Technical Details
Message-ID:
<8854@smoke.BRL.MIL>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!husc6!cmcl2!adm!smoke!gwynReferences:
<11077@elroy.Jpl.Nasa.Gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!husc6!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.std.c Subject: Re: structure assignment in dpANSI Message-ID: <8854@smoke.BRL.MIL> Date: 10 Nov 88 17:20:56 GMT References: <11077@elroy.Jpl.Nasa.Gov> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15