Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: I crashed 99 bottles.. the dot was the point (multiconcat)

by Laurent_R (Canon)
on Apr 26, 2019 at 10:17 UTC ( #1233009=note: print w/replies, xml ) Need Help??

in reply to I crashed 99 bottles.. the dot was the point (multiconcat)

It looks like an old and well-known (albeit somewhat obscure and tricky) problem in C (and C++): sometimes, you have to introduce sequence point (see for example and for more details) to make sure that all side-effects from previous evaluations are completed and that no-side effect from subsequent evaluations has been performed. If you don't do that, the behavior is undefined, which means that different C compilers may yield different results and still comply with the C standard; and I have actually observed such discrepancy of behaviors many years ago (some time in the last decade of last century) between two C compilers.

One of the typical ways to introduce a sequence point in such an expression is to add a comma. This is presumably the reason why your version with commas works as expected.

Update: fixed a couple of typos.

  • Comment on Re: I crashed 99 bottles.. the dot was the point (multiconcat)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1233009]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2023-03-28 05:59 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (66 votes). Check out past polls.