Subject: Re: Recording with wss(4) hardware seems to be broken in NetBSD-3.X, anyone else agree?
To: None <current-users@NetBSD.org, port-i386@NetBSD.org>
From: Valeriy E. Ushakov <uwe@stderr.spb.ru>
List: current-users
Date: 08/13/2007 20:06:49
On Mon, Aug 13, 2007 at 10:37:27 -0500, Eric Haszlakiewicz wrote:

> On Mon, Aug 13, 2007 at 07:44:50AM +0400, Valeriy E. Ushakov wrote:
> > +				++ports->nports;
> 
> ++ports ?  er... don't you need parenthesis around that if you're
> going to prefix the operator?

No, you don't.  See syntax for unary-expr in the C standard.
Cf. (&foo)->bar which is equivalent to foo.bar vs. &foo->bar;

-> has higher precedence, so the above is ++(ports->nports) To
increment ports you'd have to write (++ports)->nports; - and have gcc
warn about "value computed is not used" about ->nports part in this
"standalone" context.

PS: And since I'm the style rant mood - I prefer prefix notation for
that, since I hate to hunt down for that increment hidden near the
right margin in something like

    m->m_pkthdr.csum_flags = (CSUM_IP_CHECKED|CSUM_IP_VALID);
    rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
    m->m_pkthdr.csum_flags = (CSUM_IP_CHECKED|CSUM_IP_VALID|CSUM_DATA_VALID|CSUM_PSEUDO_HDR);

SY, Uwe
-- 
uwe@stderr.spb.ru                       |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen