Robotics StackExchange | Archived questions

Should ROS msg/srv files end in a newline?

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- characters plus a terminating 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.

Asked by jwhendy on 2019-07-28 23:02:22 UTC

Comments

Answers

I think this Stack Overflow gives a good tl;dr on the matter: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file

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.

Asked by stevemacenski on 2020-05-09 20:30:36 UTC

Comments