Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Laurent_R (Canon)
on Apr 26, 2019 at 10:17 UTC ( [id://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 https://en.wikipedia.org/wiki/Sequence_point and http://www.c-faq.com/expr/seqpoints.html 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found