News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

astyle problem?

Started by liuyg, September 06, 2005, 11:52:23 AM

Previous topic - Next topic

liuyg

I would like to use KR style with astyle tool, but I find this in astyle of plugin's settings of settings:

namespace foospace {     
    int Foo() {
        if (isBar) {
            bar();
            return 1;
         }
         else   --------------------????? It's very stranger. It  is not KR style
            return 0;
    }
}


KR style should be :

    namespace foospace {
        int Foo() {
            if (isBar) {
                bar();
                return 1;
            } else           ---- this
                return 0;
        }
    }


mandrav

These examples were copied verbatim from astyle's documentation.
Have you tried formatting with this style and behaves wrong?
In other words, is the sample wrong or the behaviour?
Be patient!
This bug will be fixed soon...

liuyg

HI,

Thanks for your reply.

The astyle sample in codeblocks  is wrong. I have checked  astyle document. It should be '}else' .

mandrav

Be patient!
This bug will be fixed soon...

m00

Same problem as with Linux style; it's not right. In the astyle document shows:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/astyle/astyle_1.x/astyle.html?rev=1.28
namespace foospace
{
int Foo()
{
if (isBar) {
bar();
return 1;
} else /* difference */
return 0;
}
}


But in C::B 1.0r2 has this:
namespace foospace
{
int Foo()
{
if (isBar) {
bar();
return 1;
}
else /* difference */
return 0;
}
}


K&R style problem still exist in C::B 1.0r2. I have no idea if it's arleady fixed in SVN, so just a FYI.

Michael

#5
Hello,

I have tried with RC2 (Windows XP SP2) and Linux style issue is there. K&R seems to work quite ok. This is what I get when using K&R:

Quote
namespace foospace
{                             <-- This is false
    int Foo() {
        if (isBar) {
            bar();
            return 1;
        } else /* difference */
            return 0;
    }
}

Java style has the same problem as K&R

I will check if this problem still exists with a SVN binary snapshot.

Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Michael

#6
I have tried now with C::B SVN rev1578 (from Therion), but it seems that there is another issue with K&R:

Quote
namespace foospace
{                           <-- This is false
    int Foo() {
        if (isBar) {
            bar();
            return 1;
        }
        else /* difference */       <-- This is false
            return 0;
    }
}

With linux style same difference between code and linux style example in plugin settings.

Java style has the same problem as described in my previous post.

Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

grv575

Quote from: Michael on December 28, 2005, 07:55:03 PM
I have tried now with C::B SVN rev1578 (from Therion), but it seems that there is another issue with K&R:

Quote
namespace foospace
{                           <-- This is false
    int Foo() {
        if (isBar) {
            bar();
            return 1;
        }
        else /* difference */       <-- This is false
            return 0;
    }
}

With linux style same difference between code and linux style example in plugin settings.

Java style has the same problem as described in my previous post.

Michael


This:


namespace foospace
{
    int Foo()
    {
        if (isBar) {
            bar();
            return 1;
        } else
            return 0;
    }
}


is K&R - i.e. functions use the C bracket convention, while expressions use the java bracket convention.

Michael

Quote from: grv575 on December 28, 2005, 10:23:12 PM
This:


namespace foospace
{
    int Foo()
    {
        if (isBar) {
            bar();
            return 1;
        } else
            return 0;
    }
}


is K&R - i.e. functions use the C bracket convention, while expressions use the java bracket convention.

Thank you for the explanation, but the position of else is not correct (C::B SVN rev1578) or did I miss something?

Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]