[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [4363] MusicPal: fix gcc4 build (Jan Kiszka).
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] Re: [4363] MusicPal: fix gcc4 build (Jan Kiszka). |
Date: |
Wed, 7 May 2008 13:01:33 +0100 |
User-agent: |
Mutt/1.4.1i |
On Wed, May 07, 2008 at 12:53:42PM +0100, Paul Brook wrote:
> > I'm not sure what's wrong with void * arithmetics though. They are
> > specified (somewhere) to work as if the type was a char *, and the
> > only annoyance is that you have to remember that.
>
> It doesn't work in C++ for a start.
> I thought it was a GCC extension, though I could be wrong about that.
IIRC, arithmetic on void * is said to be undefined by the standard - GCC
treats them the same as char * as a 'convenience' for people...
`-Wpointer-arith'
Warn about anything that depends on the "size of" a function type
or of `void'. GNU C assigns these types a size of 1, for
convenience in calculations with `void *' pointers and pointers to
functions.
So I'd say better off just using char * so the behaviour is guarenteed
to be defined & consistent across compilers.
Dan.
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|