Ask Your Question

Should ROS msg/srv files end in a newline?

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

jwhendy gravatar image

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

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

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-09 20:30:36 -0600

I think this Stack Overflow gives a good tl;dr on the matter:

GitHub is just pointing out the lack of following of standards that should be strictly enforced and could potentially cause issues.

But keep in mind also GitHub is just checking that for all files, it doesn't know that that is a srv/msg, java, C++, or markdown file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-07-28 23:02:22 -0600

Seen: 121 times

Last updated: May 09 '20