bug-gnulib
[Top][All Lists]
Advanced

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

Re: proposed new module intoverflow


From: Ben Pfaff
Subject: Re: proposed new module intoverflow
Date: Fri, 06 May 2011 09:16:53 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Paul Eggert <address@hidden> writes:

> I am adding some integer overflow checking to GNU Emacs, and RMS
> suggested that I make it a gnulib module, which sounds like a good
> suggestion, so here's a proposed module.

They seem like a good idea.

Did you consider adding some checking for their constraints, such
as checking that all of the arguments are really of the same
type?  This could be done with something like this, I think (not
tested, but you get the idea):

#ifdef __GNUC__
#define CHECK_COMPATIBLE_TYPES(A, B) \
        {( typeof(A) _gl_a; \
           typeof(B) _gl_b; \
           (void) sizeof(&_gl_a == &_gl_b); })
#else
#define CHECK_COMPATIBLE_TYPES(A, B)
#endif

or with __builtin_types_compatible_p() combined with the verify
macro.
-- 
Ben Pfaff 
http://benpfaff.org



reply via email to

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