guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SCM_BOOL_T became #nil ?


From: nalaginrut
Subject: SCM_BOOL_T became #nil ?
Date: Tue, 22 Feb 2011 14:09:55 +0800

hi all.
I found SCM_BOOL_T will convert to #nil in the Guile.
If we write c-function like this:
============================
SCM_DEFINE(scm_my_init, "my-init", 1, 0, 0,
            (SCM flags),
            "Initializes my env.")
#define FUNC_NAME s_scm_my_init
{
    SCM_ASSERT(scm_is_integer(flags), flags, SCM_ARG1, FUNC_NAME);

    if( init_somthing(scm_to_ulong(flags)) == -1 )
        return SCM_BOOL_F;
    else        
        return SCM_BOOL_T;

}
#undef FUNC_NAME

=============================
If init_something success, return true, else false.

And I call this "my-init" function in the Guile:
---------------------------
(if (not (my-init flags))
  (error "init failed!")
  (format #f "init ok!~%")
)
---------------------------

The problem is SCM_BOOL_T convert to #nil, and (not #nil)==>#t ! So I
can't get a logical result.

Is this conversion accepted? Or I made some mistakes?
Any help would be appreciated! Thanks!



-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut




reply via email to

[Prev in Thread] Current Thread [Next in Thread]