DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Are you actually using MISRA C++:2008 or JSF++ as a coding standard?

  1. #1
    Join Date
    May 2009
    Location
    France
    Posts
    4

    Question Are you actually using MISRA C++:2008 or JSF++ as a coding standard?

    Hello all,

    we are in the process of selecting / devising a C++ coding standard to
    use internally to our company or be able to provide feedback to our
    customers about.

    We are looking to settle on a commonly accepted standard in the
    embedded software industry and, while we are seriously considering
    both MISRA C++ 2008 and JSF++ Rev. D as likely candidates, we would
    like to assess relavance and industry adoption of those standards for general
    purpose embedded systems development.

    Hence my question: have you or someone wihtin your organization
    already deployed one of those two standards, and, should this be the case, what were the pittfalls you faced in doing so?


    TIA.

    --
    dancoud
    Last edited by dancoud; 06-01-2009 at 08:51 AM. Reason: wrong message icon initially selected

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    Standards per se don't mean much unless put in the right context, that is, in a specific project. The question is what are you project's goals? Are you aiming at top notch performance? Portability? Code stability? Ease of maintenance? Each of the options you listed has a different rating in each aspect. For example, D is a problematic choice with respect to portability and future maintenance because it's still a fledging language (not to say a beta language). Not matter how much hype you'll hear about it (you'll probably be hearing less of that soon, after the Sun has set), C++ is a better option when it comes to performance and so on.
    Danny Kalev

  3. #3
    Join Date
    May 2009
    Location
    France
    Posts
    4
    Hello Danny,

    I am not sure I understand the example about the D language. My point is not about C++ vs anything else.

    My purpose here is basically to kick-start the definition of our own coding standard by selecting either MISRA C++:2008 or JSF++ as a reference, based on:
    • known strentghs / weaknesses / coverage of C++ and OOD constructs by each of the standard,
    • feedback from real world deployment of those in the embedded software industry, and,
    • analysis of their actual adoption in industry segments outside of those from which they were initially intended.

    While I am able to make my own opinion for the first of thhose 3 points, the additional information I am looking to collect shall help to pick one of the two standards as a base and possibly augment it with well identified items from the other one.

    The outcome of this will make for our own coding standard reference, which shall (and undoubtedtly will) be customized for each project context.

    As a QA organization transversal to a (very) large R&D spanning several business units we have to provide a broard, but still relevant, foundation that each R&D / project shall be able to leverage adequately for their own purpose.

    Obvioulsy, we are aiming to achieve improvements WRT all aspects you did mention (performance, reliability, ease of maintenance ...).

    I would hope that properly designed and implemented software shouldn't have to be hard to evolve for the sole sake of v1.0 implementation performance.

    Best regards,

    --
    dancoud

  4. #4
    Join Date
    Dec 2003
    Posts
    3,366
    We made our own by starting from a CMMI level and adding to it and modifying it. One thing to consider is if you use a documentation tool that expects a certain comment format to function, and if that matches (or can fit into) the chosen standard. A standard should have low impact on performance, really, although some of the standards go so far as to limit what is allowed to be expressed most do not, to my knowledge, prevent high performance code. If the standard prevents some construct that you feel would be important to high performance, embedded code (for example, using an array instead of the STL vector for speed) then the standard should not be used or should be modified to fit your needs or allow exceptions or some such.

  5. #5
    Join Date
    Nov 2003
    Posts
    4,118
    You can look at existing code standards that are readily available online. Heres' one example (and the fact that I'm mnetioning it shouldn't be taken as an endorsement) http://www.possibility.com/Cpp/CppCo...rd.html#mnames
    and one that is less detailed (and less useful): http://geosoft.no/development/cppstyle.html
    Notioce how 2.3 in http://pst.web.cern.ch/PST/HandBookW...++standard.pdf
    conflicts with article 12 of the above Geosoft standard...

    I have to warn you that these standards are rarely portable or live up to the their expectations. Most of them end up defining and refining tiny and nonsensical rules regarding naming conventions and the exact location of the curly braces. Ironically, the folks producing these standard are all but certain that their rules will save the world.

    Ideally, we all want our code to be fast, clear, easy to maintain etc. If there were a silver bullet, everyone would be using it. A serious coding standard codex shall depend on the very specific compilers and operating systems you'll be using. I'm not talking about brand named but also about specific versions. If for example you intend to support Visual C++ 6.0 you'll have to make painful compromises about compliance with the ISO standard for example. I know Raytheon have a house-brewed standard of C++ coding and there are several Open Source projects that stick to their home-brewed standards. My advice is: build your coding standards around your development tools and around the skill level of your employees. Secondly, get used to revising your standards regularly to accommodate new features, new compilers and new libraries. I still hear about projects that stay away from templates for example.
    Last edited by Danny; 06-01-2009 at 09:27 PM.
    Danny Kalev

  6. #6
    Join Date
    Dec 2003
    Posts
    3,366
    One thing about many standards is they are designed for tool-less programming. They assume you have a text editor (I.E. VI vanilla or notepad vanilla) and a commandline compiler. So they tell you to name integers with crazy names like I64_bigint (puts the type in the variable name) because they assume you cannot mouse over a variable and get its type, and that you do not have auto-complete to fill in structure/class fields as you go so they try to provide you a way to remember the names of the thousands of variables in your system. Tools do this for you now, the extra junk just makes the names harder to read and type.

    So, if you have a functional IDE, you can cut out the bulk of the naming conventions and simply insert a statement "variable, method, type, and other names should be self documenting" into your standard. In fact, keeping the standard very simple is key to avoiding the revisions that Danny mentioned. Ours talks about braces too, it says something like "all compound statements, even if they have only one line, shall have braces. All braces will be indented to a new level and will be on a line by themself" or something like that, just 2 sentences that get the job done, not 8 paragraphs to describe indention strategy or the like. There is no need for indention strategy --- your IDE should have a button to re-indent the entire file properly after modifications, so if the braces are in the correct spots the code is easily brought up to a common look at the touch of a button. Here again, modern tools make much of the wordy standards documents obsolete.

Similar Threads

  1. C# Coding Standard?
    By Erik P. Vinther in forum .NET
    Replies: 1
    Last Post: 05-17-2002, 10:28 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center