Re: NNTPC: Problem with 0.92 and SGI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi,
> 
> I get the following error, when I try to 'make' it on a Silicon-Graphics
> INDY with IRIX 5.3 and cc.
> 
> cfe: Error: list.c, line 162: This expression is not an lvalue.
>                 ((r==1)? p2->right: p2->left) = node;  
>                 ------------------------------^
> 
> Who can help ?

I can!  DEC C has the same problem with this code, and I think the
compilers are right to complain about what looks like illegal ANSI C,
the reason being that this compiler believes that ?: doesn't return an
lvalue.

Anyway, the solution is to make the code say this:

  *(((r==1)? &p2->right: &p2->left) = node;

Turning the two possible results from ?: into pointers makes them into
lvalues which can then be accessed using the * operator.

Ray.

--
Ray Bellis, MA(Oxon) - Technical Manager - Oxford CommUnity Internet plc
Windsor House, 12 High Street, Kidlington, OXFORD OX5 2PJ   UK
      Telephone: +44-1865-856000  Fax: +44-1865-856001
Email: ray.bellis@community.net.uk   URL: http://www.community.co.uk


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux