CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Code Style Checking Tool

  1. #1
    Join Date
    Nov 2010
    Posts
    54

    Code Style Checking Tool

    Hi,

    Are there any good free or commercial software that can check the C++ code style and find any codelines that violate a given code style specification? For example, whether the codeline is indented proplery, whether the variable is using Hungarian naming notation?

    Thanks

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: Code Style Checking Tool

    Why don't you ask google about this?

    PS. After decades of programming I never was in a situation when paranoid requirements to code style were in effect.
    Best regards,
    Igor

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,725

    Re: Code Style Checking Tool

    Quote Originally Posted by Igor Vartanov View Post
    PS. After decades of programming I never was in a situation when paranoid requirements to code style were in effect.
    Me neither!
    Victor Nijegorodov

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Code Style Checking Tool

    there are "lint" type checkers which do static code analysis
    like http://cppcheck.sourceforge.net/
    they also have "style" checks, but that's not really about indents, type annotation, and/or expected casing. it's more to do about code design issues that will probably lead you to actual errors, but that aren't necessarily wrong per se.

    if you are concerned about the actual aesthetics of the code, then there are to my knowledge no checkers, but there are code (re)stylers which will take a source and format it according to desire.
    I'm not sure if any of them actually do hungarion annotation changes however.
    have a look on google for "code beautifier"

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,280

    Re: Code Style Checking Tool

    For Visual C++, you can use Resharper C++.

    http://www.jetbrains.com/resharper/f...tml?dotnetblog

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,118

    Re: Code Style Checking Tool

    Quote Originally Posted by AlanCCC View Post
    Hi,

    Are there any good free or commercial software that can check the C++ code style and find any codelines that violate a given code style specification? For example, whether the codeline is indented proplery, whether the variable is using Hungarian naming notation?

    Thanks
    Why do you need to check coding style to this detail? IME development teams have a coding style to which they should adhere (eg where to put {}, use of capitals, underscore etc in names etc etc) and any flagrant breaches are picked up as part of code review and then discussed with the individual concerned. Why do you want a tool to check coding style? How detailed is your style guidance? To get tabs, spaces, braces etc all looking the same just use a code styler that will format the code according to the rules given to it.

    Are you concerned about how the program 'looks' (ie style) or whether good practice c++ code has been used (ie code standard). I could write some ugly awful c++ code but make it look 'nice' that would probably pass a style test but should be rejected by any competent c++ reviewer.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.6.1)

  7. #7
    Join Date
    Jul 2013
    Posts
    576

    Re: Code Style Checking Tool

    Quote Originally Posted by AlanCCC View Post
    Are there any good free or commercial software that can check the C++ code style and find any codelines that violate a given code style specification?
    I think it's quite a lot to this,

    http://www.tiobe.com/index.php/conte...Standards.html

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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)