From owner-freebsd-current@FreeBSD.ORG Fri Jun 10 10:58:59 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC0EF16A421 for ; Fri, 10 Jun 2005 10:58:59 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0737243D1D for ; Fri, 10 Jun 2005 10:58:58 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j5AAwume048421; Fri, 10 Jun 2005 13:58:56 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 46759-10; Fri, 10 Jun 2005 13:58:55 +0300 (EEST) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j5AAwt93048418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Jun 2005 13:58:55 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.3/8.13.3) id j5AAxMgs079934; Fri, 10 Jun 2005 13:59:22 +0300 (EEST) (envelope-from ru) Date: Fri, 10 Jun 2005 13:59:22 +0300 From: Ruslan Ermilov To: Poul-Henning Kamp Message-ID: <20050610105922.GA79872@ip.net.ua> References: <20050610094615.GC79474@ip.net.ua> <72420.1118396985@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: <72420.1118396985@critter.freebsd.dk> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at ip.net.ua Cc: Dag-Erling Sm?rgrav , current@freebsd.org Subject: Re: [current tinderbox] failure on ...all... X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2005 10:59:00 -0000 --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 10, 2005 at 11:49:45AM +0200, Poul-Henning Kamp wrote: > In message <20050610094615.GC79474@ip.net.ua>, Ruslan Ermilov writes: >=20 >=20 > >> struct t1 { int a; } x; > >> struct t2 { int a; } y =3D { 42 }; > >> x =3D y; > >>=20 > >> The types `struct t1' and `struct t2' are not compatible and thus not > >> assignable. See 6.2.7 and 6.5.16.1. > >>=20 > >If you're to byte-copy say t1 to t2, is it guaranteed to work? That is, > >do both types are guaranteed to have the same size and alignment of their > >structure members? I'm pretty sure this is guaranteed, as lot of code > >assumes this, for example, the sockaddr* structures. >=20 > I do not belive that is guaranteed. (If it were the structs might as > well have been made assignable). You need to make sure that the two > definitions are covered by the exact same compilation conditions, > and you can't tell if a compiler has an option along the lines of >=20 > -fstruct_is_magic=3Dt2 >=20 > Which does weird things you don't know about. >=20 > The fact that it mostly works (and that we rely on this) is a > testament to the fact that compiler writers emply their destructive > creativity elsewhere. >=20 Well, the above example isn't quite different from when compiling two modules that use the same structure type t1 but one of them is compiled with -fstruct_is_magic=3Dt1. :-) Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --OXfL5xGRrasGEqWY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCqXKKqRfpzJluFF4RAnnNAJ9EqDvnkIvf16Pq2NrqCjTs8zSyxACfZtxs D0qr9HdyiOJkU0dH/eATvVk= =qtdv -----END PGP SIGNATURE----- --OXfL5xGRrasGEqWY--