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;
}
}
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?
HI,
Thanks for your reply.
The astyle sample in codeblocks is wrong. I have checked astyle document. It should be '}else' .
Thanks, I 'll correct it :)
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.
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
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
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.
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