emacs-devel
[Top][All Lists]
Advanced

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

Re: inlinable functions instead of macros


From: Tom Tromey
Subject: Re: inlinable functions instead of macros
Date: Fri, 24 Aug 2012 19:38:09 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

Paul> It's simple to put easserts into macros, but as you know this has
Paul> problems that make the macros hard to use.  They cannot be invoked
Paul> from GDB, which complicates debugging.

Why is that?  I haven't been following this, but I wonder if there is a
gdb deficiency we can easily address.

Paul> More important, callers sometimes cannot specify arguments with
Paul> side effects, and this restriction makes callers error-prone.
Paul> We've tried to address some of the side-effect issues with this
Paul> hack:

Paul>    /* The IDX==IDX tries to detect when the macro argument is 
side-effecting.  */
Paul>    #define ASET(ARRAY, IDX, VAL)  \
Paul>    (eassert ((IDX) == (IDX)),                             \

I've often wished that GCC had a __builtin_assert_no_side_effects for
use in macros.

Tom



reply via email to

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