From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: Attempting to unbox struct fields Date: Sun, 28 Feb 2016 22:56:14 -0500 Message-ID: <87h9gscgpt.fsf@netris.org> References: <8737scubaj.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456718264 9662 80.91.229.3 (29 Feb 2016 03:57:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Feb 2016 03:57:44 +0000 (UTC) Cc: Andy Wingo , guile-devel To: "Thompson\, David" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Feb 29 04:57:36 2016 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aaExg-0002B3-Ia for guile-devel@m.gmane.org; Mon, 29 Feb 2016 04:57:32 +0100 Original-Received: from localhost ([::1]:33881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaExf-00080l-Td for guile-devel@m.gmane.org; Sun, 28 Feb 2016 22:57:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaExZ-00080N-5R for guile-devel@gnu.org; Sun, 28 Feb 2016 22:57:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaExU-0000CJ-5t for guile-devel@gnu.org; Sun, 28 Feb 2016 22:57:25 -0500 Original-Received: from world.peace.net ([50.252.239.5]:56187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaExU-00009w-22 for guile-devel@gnu.org; Sun, 28 Feb 2016 22:57:20 -0500 Original-Received: from pool-71-174-32-69.bstnma.east.verizon.net ([71.174.32.69] helo=jojen) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aaEwg-0007LN-2S; Sun, 28 Feb 2016 22:56:30 -0500 In-Reply-To: (David Thompson's message of "Sun, 28 Feb 2016 16:30:21 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 50.252.239.5 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:18198 Archived-At: Hi David, "Thompson, David" writes: > Here's a patch I came up with to enable (and fix where necessary) the > support for signed integer and double struct fields. Great, thanks for working on it! This is not a proper review, just a couple of questions and comments. > Am I on the right track here? The first thing I noticed is that the patch assumes that doubles are the same size as pointers. Obviously this is not the case on 32-bit systems. What's the plan for those systems? The patch also currently assumes that longs and pointers are the same size, and this turns out to be false on LLP64 systems such as 64-bit Windows. See . However, it should be straightforward to fix this issue. > + if ((prot != 'r' && prot != 'w') || inits_idx == n_inits) > + *mem = 0.0; Note that 'mem' is of type scm_t_bits*, so the 0.0 will be converted to the integer 0 and then stored as an integer, which I guess is not what you meant. Note that in practice this works on IEEE 754 systems, where 0.0 is represented as all zero bits, but the code is somewhat misleading and less portable than it could be. Thanks, Mark