richpodraza Posted March 21, 2013 Report Share Posted March 21, 2013 I am wondering if there is a preferred (official or unofficial) coding and style convention in the SystemC community? I'm talking about things like variable and class names, member data prefixes, function parameter prefixes, automatic variable prefixes, etc. If there is no consensus feel free to comment on YOUR favorite! Quote Link to comment Share on other sites More sharing options...
David Black Posted March 21, 2013 Report Share Posted March 21, 2013 There is no "SystemC" standard. Remember that SystemC is really just a C++ library (API). Using a common C++ coding standard of which there are several (e.g. JSF) is a good place to start. Here are a few ideas: Indentation (a hotly debated topic) - I prefer two spaces. Look for tools support to automate this aspect. Variable names should not be abbreviated, but rather use lowercase and separate words with underscore. Classes should start with Uppercase letter. Member data other than channels/sockets, should be prefixed with m_. Class static variables should be prefixed with s_. Suffixes should indicate process types (i.e. _thread, _method, _cthread), channels (_channel), events (_event), ports/sockets (_port/_socket). More importantly, if you are going to use a standard, there should be a tool that can help enforce/code. WARNING: You might want to avoid any standard suggesting leading underscores and a few other things. See the following Stack Overflow article for a discussion of this <http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier>. maehne 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.