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: guile bugs


On 16 Sep 1999, Jim Blandy wrote:

> > 1) SCM_BOOL_F should be 0 so it is false in C
> 
> If someone were to make this change and show me before and after
> benchmark results (see guile-modules/benchmarks), then that would help
> persuade me.

I think this should not be done, independent of any benchmark results.
The main reason for this change would be to make sure that SCM_BOOL_F is
not accidentally used as a boolean value.  If, instead, it would be
possible to guarantee that using a SCM value as a boolean value will lead
to a compile time error, everything is fine.

If I understand correctly from some previous mail, defining SCM as a
union would serve that purpose.

> > 2) SCM should not be a long, but instead be a pointer to undefined
> > struct as we discussed before.  This would prevent misuse of an integer
> > as a Scheme value.
> 
> I'd love to see this change happen.

If such a change is done, it might be done in a way that would let guile
compile independent of whether SCM is defined either as a union or as a
pointer to an undefined struct.

Then, we could have something like a "find compile time error"-mode by
defining SCM as a union.  This would only be used for developers, since it
would lead to performance penalties.  In all other cases, SCM would just
be defined as a pointer to an undefined struct.

example:

#ifdef FIND_COMPILE_TIME_ERROR_MODE
[define SCM as a union]
#else
[define SCM as a pointer to an undefined struct]
#endif

This way, 1) would become unnecessary.  However, it possibly requires more
effort when doing 2).  Still, even 2) will introduce an awful lot of
casting.

Best regards,
Dirk Herrmann


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