[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gcc3 and compiler warnings
From: |
James Morrison |
Subject: |
Re: gcc3 and compiler warnings |
Date: |
Sun, 7 Apr 2002 08:24:43 -0700 (PDT) |
--- Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> wrote:
> 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.
Would this not change semantics of the line by moving the pointer p before
dereferencing it?
>
> Thanks,
> Marcus
>
=====
James Morrison
University of Waterloo
Computer Science - Digital Hardware
2A co-op
http://hurd.dyndns.org
Anyone refering this as 'Open Source' shall be eaten by a GNU
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/