[asterisk-dev] [asterisk-commits] file: trunk r81345 - /trunk/main/event.c

Tony Mountifield tony at softins.clara.co.uk
Wed Aug 29 16:38:32 CDT 2007

In article <46D5DB51.2050305 at digium.com>,
Kevin P. Fleming <kpfleming at digium.com> wrote:
> Luigi Rizzo wrote:
> > As far as i remember pointer arithmetic on "void *" is a gnu
> > extension not guaranteed to work on all compilers.
> > You should use char * to be standard compliant (even better,
> > something like a NEXT_IE(x) macro that takes care of the
> > conversion throughout the file.
> Asterisk is developed on and only supported on the GNU compiler suite;
> users are welcome to build it using other compilers and we'll be happy
> to hear when it works, but we won't make changes to accommodate non-GNU
> compilers. There are other places in Asterisk already where we do
> pointer math using 'void *' pointers and I don't see any reason to avoid
> it just to cater to compilers that we don't support :-)

Because arithmetic on void* pointers is not really valid C? GCC just pretends
a "void" is 1 byte long, but it really has undefined size. Sometimes GCC
goes beyond providing useful features into encouraging sloppy programming!

It would be interesting to see how much actually gets flagged by compiling
with -Wpointer-arith

Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org

More information about the asterisk-dev mailing list