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 19:22:32 +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 1215796997 14611 80.91.229.12 (11 Jul 2008 17:23:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jul 2008 17:23:17 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jul 11 19:24:04 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 1KHMLc-0006V3-He for guile-devel@m.gmane.org; Fri, 11 Jul 2008 19:23:56 +0200 Original-Received: from localhost ([127.0.0.1]:41008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KHMKk-0007si-Q4 for guile-devel@m.gmane.org; Fri, 11 Jul 2008 13:23:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KHMKh-0007sM-0R for guile-devel@gnu.org; Fri, 11 Jul 2008 13:22:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KHMKg-0007s4-8C for guile-devel@gnu.org; Fri, 11 Jul 2008 13:22:58 -0400 Original-Received: from [199.232.76.173] (port=39813 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KHMKg-0007ry-17 for guile-devel@gnu.org; Fri, 11 Jul 2008 13:22:58 -0400 Original-Received: from smtp.getmail.no ([84.208.20.33]:39016) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KHMKg-0002Iy-7f for guile-devel@gnu.org; Fri, 11 Jul 2008 13:22:58 -0400 Original-Received: from pmxchannel-daemon.no-osl-m323-srv-009-z2.isp.get.no by no-osl-m323-srv-009-z2.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) id <0K3U00313QXYQ600@no-osl-m323-srv-009-z2.isp.get.no> for guile-devel@gnu.org; Fri, 11 Jul 2008 19:22:46 +0200 (CEST) Original-Received: from smtp.getmail.no ([10.5.16.1]) by no-osl-m323-srv-009-z2.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTP id <0K3U00JOCQXP1520@no-osl-m323-srv-009-z2.isp.get.no> for guile-devel@gnu.org; Fri, 11 Jul 2008 19:22:37 +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 <0K3U00KHTQXPSDJ7@no-osl-m323-srv-009-z1.isp.get.no> for guile-devel@gnu.org; Fri, 11 Jul 2008 19:22:37 +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:7369 Archived-At: Ludovic Court?s: > "Kjetil S. Matheussen" writes: > >> The code in question doesn't run on those platforms anyway, >> since there's a lot of strict linux stuff. > > You are certainly aware that GNU/Linux *is* available on sparc64, alpha, > etc. > Well, yes, but he wrote windows 64, sparc64, alpha etc. >> 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. > > Again, it's not "perfectly legal", no matter whether you do it > "correctly" (whatever that means) or not: the C standard makes no > provision regarding the size of `long' versus the size of pointer types. > It happens to work on the mainstream platforms you're using, but it's > definitely not portable. > > And I suppose that's the reason why you want `scm_{to,from}_uintptr ()' > in the first place, otherwise you'd just live (dangerously) with > `scm_{to,from}_unsigned_long ()'. > Yes, and this is a stupid discussion. We don't really disagree about anything unless anyone thinks I should change all my code using scheme numbers to hold pointers into SMOB's, which would significantly increase the code size which further would increase the chance of bugs. There are, as I have given examples of already, types of pointer where SMOB's are overkill. And just for trying out smaller things, it a lot of work to set up all that SMOB code (again!). I do a lot of interaction between C and scheme, and avoiding SMOBs as much as possible saves me a lot of time.