On Thu, Jun 18, 2020 at 05:26:34PM +0200, Jean-Marc Lasgouttes wrote:
> Le 18/06/2020 ?? 17:19, Pavel Sanda a écrit :
> >Thanks, I committed the first patch with consts added (binding to 
> >temporaries).
> >I propose to drop the second patch altogether. Unless you use simple 
> >expressions
> >chaining is not particularly safe, << is not a sequence point so order of 
> >evaluation
> >is undefined.
> 
> What do you mean? We do that all over the place with streams. I thought it
> was how streams were supposed to be used.

Depends what you mean by "that".
Simply put, chaining is OK when the expresions (out << expr1 << expr2 ...;)
don't have chance to interact with each other.
So "simple" code like out << var1 << var2 << string3 ..; etc is just fine.
If, on the other hand, exprX messes with some variables which are used in exprY
then you get undefined behaviour because standard leave the order undefined.
Putting ';' (or any other sequence point) between the expressions gives you 
guaranteed order.

If you think we do have the second case in the code already, we should better 
review it :)

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to