[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gcc3 and compiler warnings
From: |
Marcus Brinkmann |
Subject: |
Re: gcc3 and compiler warnings |
Date: |
Sun, 7 Apr 2002 16:23:59 +0200 |
User-agent: |
Mutt/1.3.28i |
On Sat, Apr 06, 2002 at 02:34:08PM -0800, James Morrison wrote:
> Hi,
>
> gcc3 produces warnings for code that looks like:
> major = ntohl (*p++);
> where p is a pointer. There is a lot of code that looks like this in
> hurd/nfs.
> would the fix look like:
> major = ntohl (*p); p++;
We will never do anything like this.
> or
> major = ntohl (*p);
> p++;
This is acceptable.
> or
> major = ntohl (p[0]);
> ...
> p = &p[2];
I consider this to be awkward.
The simplest way is probably to add parenthesis:
major = ntohl (*(p++));
This works fine, and I use it in all my code since I use gcc 3.0.
Thanks,
Marcus
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de