Ask Your Question

name rules for name of *.msg file

asked 2018-07-04 21:31:21 -0600

lxbeyond gravatar image

updated 2018-07-10 13:08:42 -0600

jayess gravatar image

Recently we found a strange thing when building msg file: in case one, we build one msg file whose name is "MyTest.msg", whatever content in it , which just build well, in case two , we want to build another msg file whose name is "MYTEST.msg", whatever content in it , which still build well. but as Naming of messages and services said

names must use an upper camel case

why case 2 work? test rep:

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2018-07-10 12:53:46 -0600

marguedas gravatar image

The CamelCase is being enforced, in the sense that myMessage.msg or myservice.srv will fail to compile. For the case of all caps / multiple uppercase characters, it's harder to enforce are there is no way to know what is a acronym and what is a word. So OSRFUAV.msg should be valid, but MYTEST.msg should not. So we decided to not prevent that use case at the moment relying on users to use CamelCase and so to have multiple uppercase characters only in the case of acronyms.

Note that if you have MYTEST.msg and MyTest.msg, the generated files and symbols won't collide as they are converted from CamelCase to lowercase_with_underscores.

MYTEST.msg  -> _mytest,py
            -> mytest.hpp
MyTest.msg  ->
            -> my_test.hpp

And the resulting symbols:

MYTEST.msg -> class MYTEST (Python)
           -> struct MYTEST_ (C++)
MyTest.msg -> class MyTest
           -> struct MyTest_
edit flag offensive delete link more

answered 2018-07-05 02:30:56 -0600

bouke gravatar image

The quote about camelcase is under 'conventions', which means that it is a rule that is not enforced, but recommended.

edit flag offensive delete link more



The convention exists since having two message files which only differ in the case will not work on platforms which can't distinguish these two files in the file system (or anywhere else in the pipeline).

Dirk Thomas gravatar image Dirk Thomas  ( 2018-07-05 08:50:09 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2018-07-04 21:31:21 -0600

Seen: 262 times

Last updated: Jul 10 '18