djb@spacely.Jpl.Nasa.Gov (Daniel J. Burns) (11/10/88)
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 ; /* ??? */ -- Dan Burns Jet Propulsion Laboratory djb@spacely.jpl.nasa.gov
gwyn@smoke.BRL.MIL (Doug Gwyn ) (11/11/88)
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.