V5 Motors and Layered Comments


#1

Hello all,
I was doing some testing on what is our “state bot”, and discovered that motors (v5) were running at full speed for 3 seconds (exactly timed it multiple times) then cut to about half power after then until they were reactivated (button pressed again). I’ve narrowed down the problem to an accidental layered comment in my program. Has anyone else encountered this problem? (Yes, I know that layered comments can cause problems in certain compilers, just wondering).


#2

What is a “layered comment”?


#3

If I am understanding correctly I think he is talking about muti line comments


#4

Sorry, comments inside comments


#5

Please post an example.


#6

/*
motorL.stop()
/*
motorR.stop()
*/
motorLift.stop()
*/


#7

What is the purpose of doing comments in this manner?

Also, for future reference: How to post code on the forum


#8

It was a mistake to begin with, I’m now using ifdef to control commented code. I was wondering if anyone had experienced simaler issues if they had done the same thing (since the behavior is somewhat random and had nothing to do with the commented code)


#9

Also thanks for the reminder of using BBcode!


#10

I’ve had layered comments give me all sorts of issues in many different coding languages and platforms, when coding anything I highly suggest avoiding doing them. nothing worse then when random lines get ignored or lines meant to be ignored break the program.


#11

These “layered comments” don’t work in c++. I’m surprised your editor didn’t underline one of the */ and throw an error. The only language that I know for sure supports these things is swift.