From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Kjetil S. Matheussen" Newsgroups: gmane.lisp.guile.devel Subject: Re: Passing C pointers through guile Date: Fri, 11 Jul 2008 15:12:57 +0200 (CEST) Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7BIT X-Trace: ger.gmane.org 1215782111 24844 80.91.229.12 (11 Jul 2008 13:15:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jul 2008 13:15:11 +0000 (UTC) Cc: guile-devel@gnu.org, "Kjetil S. Matheussen" To: Greg Troxel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jul 11 15:15:58 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KHITP-0004pU-TG for guile-devel@m.gmane.org; Fri, 11 Jul 2008 15:15:44 +0200 Original-Received: from localhost ([127.0.0.1]:46174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KHISY-0008CF-6I for guile-devel@m.gmane.org; Fri, 11 Jul 2008 09:14:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KHISS-0008Ba-7l for guile-devel@gnu.org; Fri, 11 Jul 2008 09:14:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KHISR-0008BI-Dr for guile-devel@gnu.org; Fri, 11 Jul 2008 09:14:43 -0400 Original-Received: from [199.232.76.173] (port=39187 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KHISR-0008BD-9M for guile-devel@gnu.org; Fri, 11 Jul 2008 09:14:43 -0400 Original-Received: from smtp.getmail.no ([84.208.20.33]:41276) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KHISR-0004kz-06 for guile-devel@gnu.org; Fri, 11 Jul 2008 09:14:43 -0400 Original-Received: from pmxchannel-daemon.no-osl-m323-srv-004-z2.isp.get.no by no-osl-m323-srv-004-z2.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) id <0K3U00C0JFFWPS00@no-osl-m323-srv-004-z2.isp.get.no> for guile-devel@gnu.org; Fri, 11 Jul 2008 15:14:20 +0200 (CEST) Original-Received: from smtp.getmail.no ([10.5.16.1]) by no-osl-m323-srv-004-z2.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTP id <0K3U0021BFEI9X90@no-osl-m323-srv-004-z2.isp.get.no> for guile-devel@gnu.org; Fri, 11 Jul 2008 15:13:30 +0200 (CEST) Original-Received: from cm-84.215.136.96.getinternet.no ([84.215.136.96]) by no-osl-m323-srv-009-z1.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTP id <0K3U008RJFE8KD96@no-osl-m323-srv-009-z1.isp.get.no> for guile-devel@gnu.org; Fri, 11 Jul 2008 15:13:30 +0200 (CEST) In-reply-to: X-X-Sender: kjetil@ttleush X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7367 Archived-At: On Fri, 11 Jul 2008, Greg Troxel wrote: > "Kjetil S. Matheussen" writes: > >> Also, various types of non-gc pointers are stored in integers in >> all of the rt-*.scm files in http://snd.cvs.sourceforge.net/snd/cvs-snd/ >> and many others (xg.c, etc.). It would be horribly idiotic >> to write smurf's for all of those, or at least a common smurf, when a >> single integer is enough. > > What fraction of these uses are actually correct? Have people run this > code on Windows 64 (which is LLP64, but on which long is 32 bits), > sparc64, and alpha. All of them are correct. The alternative would be messier code. The code in question doesn't run on those platforms anyway, since there's a lot of strict linux stuff. However, I don't the storage of pointers in unsigned longs (which is a perfectly legal thing to do if done correctly), would pose any problem for running it on other hardware. > I'm always worried when people store pointers in > integers - it's IMHO basically a wrong thing to do. > In many situations, like the one above, it's a perfectly fine thing to do, and also the only sane option. Of course, you must know what you are doing.