*BSD News Article 17521


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!crcnis1.unl.edu!wupost!math.ohio-state.edu!howland.reston.ans.net!xlink.net!fauern!news.tu-chemnitz.de!irz401!uriah!not-for-mail
From: j@bonnie.tcd-dresden.de (J Wunsch)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Who has had success with xview 3.0?
Date: 25 Jun 1993 18:11:01 +0200
Organization: Textil Computer Design GmbH, Dresden, Germany
Lines: 26
Message-ID: <20f82lINNc54@bonnie.tcd-dresden.de>
References: <C91FHt.LCB@ra.nrl.navy.mil> <1993Jun24.013940.20757@news.arc.nasa.gov>
NNTP-Posting-Host: bonnie.tcd-dresden.de
Keywords: xview 3.0

In article <1993Jun24.013940.20757@news.arc.nasa.gov> root@wanderer.nsi.nasa.gov (Michael C. Newell) writes:
>I had a LOT of problems, until I started looking for constructs
>of the form "something = case ? value1 : value2".  I changed
>them to "if (case) something = value1; else something = value2;"
>and it cleaned up the problem.  I've had this same problem with
>a number of other c compilers; I don't understand why, but 
>changing the code as above fixes it every time.
>
But it's really a difference. While ``a = b? c: d'' is just an
expression (it's only made a statement if you just add a semicolon),
``if(b) a=c; else a=d;'' is always a statement. Thus, there might
be cases where you can't workaround your way, since the resulting
value of the expression is being used elsewhere. (A statement ain't
got a resulting value.)

For my experience, gcc's handling of those expressions isn't broken
anyway. So if it brakes some code, it must be the program itself.
The operator precedence rules appear to be a bit mysterious. Espec-
ially, if you look at precedence of comma and assignment operators.
In case of not being obvious, simply set a pair of paren's around
the expression in question.
-- 
in real life: J"org Wunsch |   )  o o  | primary: joerg_wunsch@tcd-dresden.de
above 1.8 MHz:   DL 8 DTL  |    )  |   | private: joerg_wunsch@uriah.sax.de
                           | . * ) ==  |
          ``An elephant is a mouse with an operating system.''