emacs-devel
[Top][All Lists]
Advanced

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

Re: Strangeness in ASRT


From: Stefan Monnier
Subject: Re: Strangeness in ASRT
Date: Sun, 10 Feb 2008 14:38:17 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> This seems to have a bug which breaks compilation.
>     /* The IDX==IDX tries to detect when the macro argument is 
> side-effecting.  */
>     #define ASET(ARRAY, IDX, VAL)     \
>       (eassert ((IDX) == (IDX)),                              \
>        eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
>        ASLOT ((ARRAY), (IDX)) = (VAL))

> Changing ASLOT to AREF makes it compile.  (Bootstrapping still crashes
> as before.)

Oh, yes, it should be AREF, not ASLOT.  Sorry for the mixup.

> What is the purpose of these tests?  The expansion of AREF
> substitutes IDX only once, so there is no problem if it has
> a side effect.

If ENABLE_CHECKING is true, then eassert ((IDX) >= 0 && (IDX) < ASIZE
(ARRAY)) will cause IDX to be eval'd several times, so you'll get errors
when you set ENABLE_CHECKING and an argument has the form "index++".


        Stefan




reply via email to

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