Should ROS msg/srv files end in a newline?

asked 2019-07-28 23:02:22 -0500

jwhendy gravatar image

updated 2019-07-28 23:02:41 -0500

I was perplexed on a recent commit preview to see this symbol on github after a .srv file with no return:

image description

I posted a question on SO, which turned out to be a duplicate of this one, which enlightened me via this one and a subsequent link in a comment that apparently lines not ending in a newline may not be lines at all!

Re-quoting their POSIX standard citation for convenience:

3.206 Line

A sequence of zero or more non- <newline> characters plus a terminating <newline> character.

The answer to one of these questions advises:

Note that it is a good style to always put the newline as a last character if it is allowed by the file format. Furthermore, for example, for C and C++ header files it is required by the language standard.

I can't find anything stating 1) whether or not any downsides occur to having a newline in .msg files, 2) if it's explicitly permitted (presumably so) or 3) if it's advised to always use them.

edit retag flag offensive close merge delete