In the O Codes chapter is this statement correct?
The behavior is undefined if: Comments are used on a line with an O-word
I’ve tested in 2.7 adding comments after the O-word with no errors.
o100 sub (test)
(msg, o100 test)
o100 endsub (end test)
o100 call (call test)
M2
评论 (6)
#2 – jethornton 于 2018-06-30
That question in that link seems to say “undefined because different compliers do different things in C++”. It seems to me with only one parser that it either works or does not work.
#3 – andypugh 于 2018-06-30
On 30 June 2018 at 15:26, jethornton
> That question in that link seems to say “undefined because different
> compliers do different things in C++”. It seems to me with only one parser
> that it either works or does not work.
>
To be pedantic, there are at least two parsers, and the infrastructure
allows for more.
—
atp
#4 – jepler 于 2018-06-30
““
READ => G0 X0 (hi)
6 N..... COMMENT("hi")
7 N..... STRAIGHT_TRAVERSE(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
READ => G0 (hi) X0
8 N..... COMMENT("hi")
9 N..... STRAIGHT_TRAVERSE(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
READ => O100 (hi) if
Unknown control command in o word
O100 (hi) if
Comments in O-word lines do not work in the same way as comments in other places.
Another way to look at a statement that such and such is undefined behavior is that the developers want to retain wiggle room here and make future changes.
#5 – jethornton 于 2018-06-30
Thanks, should there be a recommendation in the docs to not put comments on the same line as the o word as the behaviour may change in the future? This seems to explain better why it might work now but not work in the future.
#6 – jethornton 于 2018-07-09
The documents have been updated to to inform users not to put comments on the same line as the O word and the examples corrected
#1 – andypugh 于 2018-06-30
On 30 June 2018 at 13:24, jethornton wrote:
> In the O Codes chapter is this statement correct?
> The behavior is undefined if: Comments are used on a line with an O-word
>
“Undefined behaviour” can and does include “works as you wanted it to”
https://stackoverflow.com/questions/2235457/how-to-explain-undefined-behavior-to-know-it-all-newbies
—
atp