This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Suggestion: SCM_DEBUG_REST_ARGUMENTS (fwd)
Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> However, for the long term I think we could really use macros like the
> following:
>
> SCM_DEBUG_CELL_ACCESSES -- Check cell accesses exhaustively, i. e. verify
> that the cell pointers actually point to a cell on the heap. scm_cellp is
> a predicate which already performs that kind of test. We could go even
> further here, by also checking that cell elements written as objects are
> always read as objects, and that cell elements written as raw data are
> always read as raw data. (see file doc/api.txt)
>
> SCM_DEBUG_PAIR_ACCESSES -- This is what you suggested for pairs: make
> sure that SCM_CAR and friends are only applied to real cons cells.
Those macros will be used like this, right?
SCM foo (SCM obj)
{
SCM_DEBUG_PAIR_ACCESSES (obj);
return SCM_CAR (obj);
}
In this case, I have to always think of where the object may be wrong
type. Instead, I'd like to just write
SCM foo (SCM obj)
{
return SCM_CAR (obj);
}
and if something goes wrong, I want to turn on the Guile's debug option.
Do you think it is possible?
> #ifndef SCM_DEBUG_DEPRECATED
> #define SCM_DEBUG_DEPRECATED SCM_DEBUG
> #endif
>
> and make sure that SCM_DEBUG is defined as the very first of these
> macros. This simple hack would allow to achieve what you have suggested,
> and would still allow to override those macros from the command line.
>
> Cool, isn't it :-)
Yes, that's great :)
-- Kei