From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Noah Roberts Newsgroups: gmane.lisp.guile.user Subject: Re: smob pointer moving Date: Sat, 01 Feb 2003 22:56:44 -0800 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <3E3CC12C.7070800@reachone.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1044169440 21410 80.91.224.249 (2 Feb 2003 07:04:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 2 Feb 2003 07:04:00 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18fEAX-0005Z3-00 for ; Sun, 02 Feb 2003 08:03:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18fEBs-0008KW-00 for guile-user@m.gmane.org; Sun, 02 Feb 2003 02:05:20 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18fEBB-0007Yw-00 for guile-user@gnu.org; Sun, 02 Feb 2003 02:04:37 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18fEAx-0006wk-00 for guile-user@gnu.org; Sun, 02 Feb 2003 02:04:27 -0500 Original-Received: from mail-front2.reachone.com ([216.177.224.13]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18fEAo-00068U-00 for guile-user@gnu.org; Sun, 02 Feb 2003 02:04:15 -0500 Original-Received: from reachone.com (dialup-228-136.reachone.net [216.177.228.136]) by mail-front2.reachone.com (Postfix) with ESMTP id 54E0947A88 for ; Sat, 1 Feb 2003 23:11:38 -0800 (PST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020605 X-Accept-Language: en-us, en Original-To: guile-user X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: General Guile related discussions List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:1592 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:1592 Steve Tell wrote: >>SCM db_open(SCM obj) >>{ >> Database *db = DB(db); >> >> > >I think you mean DB(obj) above. Typo in email, or perhaps your real >problem? > Actually it looks like it was very possibly a typo in code. The argument was named db to begin with and I had decided to change it in favor of having that name for the converted variable - probably forgot to change the above. Pretty embarasing actually :P >One other thing wrong that I see here: You're not checking that >obj really is a database smob before casting it and chasing the >(possibly random) pointer. > Yeah, I hadn't gotten to that part in my searching - seems that finding thurough information on guile is a bit tough. It is all out there, but scattered between various mailing lists, info pages, tutorials, and of course the source code itself, but I am beginning to get all the parts I require mapped out. >(recent docs indicate that SCM_SMOB_PREDICATE() and SCM_ASSERT() are >available for this, probably a better choice.) > That is what I found and preliminary testing indicates that it is what is "supposed" to be used.... SCM_ASSERT(SCM_SMOB_PREDICATE(db_id, obj), obj, SCM_ARG1, "db-open"); It was actually in this document that I found SCM_SMOB_DATA as well. >> printf("Database is at %p\n", db); >> db->open(); >> printf("db_open called.\n"); >> return SCM_EOL; >>} >> Thanks for the info, it looks like it was plain sloppyness and not missinformation or lack of understanding that caused my problem. After seing what caused the error I think it best to use SCM_SMOB_DATA in all cases so that my code is not relying on a specific implementation of smobs in case they change in later releases. That probably won't happen, but better to use the existing macro than to make up my own, I just have to know about them first :P Thanks, NR _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user