This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SCM_NUM2LONG_DEF fix?


On 13 Jan 2000, Greg J. Badros wrote:

>Janis Dzerins <jonis@mt.lv> writes:
>
>> Hello!
>> 
>> I'm posting to this list first time although I've been following it for
>> some time already. I hope to join the developement team of guile
>> sometimes but until then I have one question:
>> 
>> Should the following line in scm_validate.h:
>> 
>> #define SCM_NUM2LONG_DEF(pos,arg,def) (SCM_UNBNDP(arg)?SCM_MAKINUM(def):(scm_num2long(arg, (char *) pos, FUNC_NAME)))
>>                                                        ^^^^^^^^^^^^^^^^
>> be like this:
>> 
>> #define SCM_NUM2LONG_DEF(pos,arg,def) (SCM_UNBNDP(arg)?(def):(scm_num2long(arg, (char *) pos, FUNC_NAME)))
>>                                                        ^^^^^
>
>Well, there's only one place where it is currently used (filesys.c):
>
>  imode = SCM_NUM2LONG_DEF(3,mode,0666);
>
>so it's right relative to that use.  The question is whether the use
>should be:
>
>  imode = SCM_NUM2LONG_DEF(3,mode,SCM_MAKINUM(0666));
> 
>and I prefer the former, and I've done things that way with, e.g.,
>SCM_VALIDATE_INUM_DEF_COPY, too, as well as with analagous macros in
>Scwm.  It handles the common case better.

Shame on me that I did not check use of this macro first. But I still
see one little problem---with current definition it's impossible to get
a default long larger than 2^30, right?

And, BTW, if i understand the scm_open_fdes correctly, there is a bug in
it anyway: if mode is not passed, after the call to

	imode = SCM_NUM2LONG_DEF(3,mode,0666);

imode will be (((0666)<<2)+2L) and as such passed to open syscall. I
checked, and this sure is a BUG.

>And please hop on board with development of Guile... a great way to
>start is by contributing documentation strings for the various
>SCM_DEFINE procedures that still need them!

I *love* guile and I'll do what I can for it to be the extension
language of choice for open-source and free-software developers.

>Thanks,
>Greg
>

--
jonis

Writing free verse is like playing tennis with the net down.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]