unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* scm_num_eq
@ 2004-01-23  0:55 Roland Orre
  2004-01-23  1:21 ` scm_num_eq Marius Vollmer
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Orre @ 2004-01-23  0:55 UTC (permalink / raw)


Hi,
This code gives the expected result:
 if (SCM_EQ_P(SCM_CDR(handle),SCM_MAKINUM(0)))

but this code doesn't:
  if (scm_num_eq_p(SCM_CDR(handle),SCM_MAKINUM(0)))

as this latter code always gives false back.

I guess it wouldn't matter how the background is, but this
is the case. The key cell is a local variable.

  scm_t_cell key;
  SCM tmp;
  SCM_SETCAR((SCM)&key,SCM_MAKE_STRING_TAG (slen));
  SCM_SETCDR((SCM)&key,(scm_t_bits) str);
  SCM handle=
    scm_hash_fn_create_handle_x (table, (SCM) &key, SCM_MAKINUM(0),
				 scm_ihash, scm_sloppy_assoc, 0);

	Best regards
	Roland Orre




_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: scm_num_eq
  2004-01-23  0:55 scm_num_eq Roland Orre
@ 2004-01-23  1:21 ` Marius Vollmer
  2004-01-23  8:35   ` scm_num_eq Roland Orre
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Vollmer @ 2004-01-23  1:21 UTC (permalink / raw)
  Cc: bug-guile

Roland Orre <roland.orre@neurologic.se> writes:

> Hi,
> This code gives the expected result:
>  if (SCM_EQ_P(SCM_CDR(handle),SCM_MAKINUM(0)))
>
> but this code doesn't:
>   if (scm_num_eq_p(SCM_CDR(handle),SCM_MAKINUM(0)))
>
> as this latter code always gives false back.

Hmm, it should always be true: scm_num_eq returns either SCM_BOOL_F or
SCM_BOOL_T which are both true in the eyes of C.  Try this:

  if (!SCM_NFALSEP (scm_num_eq_p(SCM_CDR(handle),SCM_MAKINUM(0))))

(Why don't we have SCM_TRUEP?)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: scm_num_eq
  2004-01-23  1:21 ` scm_num_eq Marius Vollmer
@ 2004-01-23  8:35   ` Roland Orre
  0 siblings, 0 replies; 3+ messages in thread
From: Roland Orre @ 2004-01-23  8:35 UTC (permalink / raw)
  Cc: bug-guile

Whoops, I must have been tired when I wrote that line (OK, it was late)
I didn't notice that scm_num_eq returned SCM, and yes,you were right, it
did always return true, not false as I had claimed. Thanks!

	Best regards
	Roland

On Fri, 2004-01-23 at 02:21, Marius Vollmer wrote:
> Roland Orre <roland.orre@neurologic.se> writes:
> 
> > Hi,
> > This code gives the expected result:
> >  if (SCM_EQ_P(SCM_CDR(handle),SCM_MAKINUM(0)))
> >
> > but this code doesn't:
> >   if (scm_num_eq_p(SCM_CDR(handle),SCM_MAKINUM(0)))
> >
> > as this latter code always gives false back.
> 
> Hmm, it should always be true: scm_num_eq returns either SCM_BOOL_F or
> SCM_BOOL_T which are both true in the eyes of C.  Try this:
> 
>   if (!SCM_NFALSEP (scm_num_eq_p(SCM_CDR(handle),SCM_MAKINUM(0))))
> 
> (Why don't we have SCM_TRUEP?)



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-23  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-23  0:55 scm_num_eq Roland Orre
2004-01-23  1:21 ` scm_num_eq Marius Vollmer
2004-01-23  8:35   ` scm_num_eq Roland Orre

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).