C/C++ canonicaliser?

Posted by A T on Programmers See other posts from Programmers or by A T
Published on 2012-10-23T08:24:26Z Indexed on 2012/10/23 11:18 UTC
Read the original article Hit count: 175

Filed under:
|
|

Are there any C/C++ automated canonicallisers? - Something like astyle but which makes your code more concise, rather than formats it?

For example, to go from:

float foo() {
    float a;
    float b;
    a = 9455.34;
    b = 3543.8;
    return a*b;
}

int main(void) {
    float b;
    b = foo();
    return 0;
}

To:

float foo(); // Automated prototype creation

int main(void) {
    float b = foo();
    return 0;
}

float foo() {
    return 9455.34*3543.8;
}

(this is my coding style FYI: to reduce the lines-of-code without sacrificing readability)

© Programmers or respective owner

Related posts about c++

Related posts about scripting