From: Noah Roberts <nroberts@reachone.com>
Subject: Re: smob pointer moving
Date: Sat, 01 Feb 2003 22:56:44 -0800 [thread overview]
Message-ID: <3E3CC12C.7070800@reachone.com> (raw)
In-Reply-To: Pine.LNX.4.21.0302020107470.15152-100000@ariel.lan.telltronics.org
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
prev parent reply other threads:[~2003-02-02 6:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-02 3:51 smob pointer moving Noah Roberts
2003-02-02 6:38 ` Steve Tell
2003-02-02 6:56 ` Noah Roberts [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E3CC12C.7070800@reachone.com \
--to=nroberts@reachone.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).