News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Code formatter

Started by Icek, May 03, 2007, 08:43:51 PM

Previous topic - Next topic

Icek

Hi, i use CB on linux (ubuntu 6.10 and/or 7.04), but i have problem with Astyle source formatter. After formatting my code looks like this :


bool CVERTEX3F::operator==(const CVERTEX3F druhy)const
{
if ( this->x == druhy.x  &&
         this->y == druhy.y  &&
         this->z == druhy.z  )
return true;
else
     return false;
     
    }
   
    bool CVERTEX3F::operator!=(const CVERTEX3F druhy)const
        {
         if ( this->x != druhy.x  ||
                 this->y != druhy.y  ||
                 this->z != druhy.z  )
         return true;
         else
             return false ;
            }
           
           
            float CVERTEX3F::GetMax()
                {
                 if (this->x > this->y)
                 {
                  if (this->x > this->z)
                      {
                       return this->x;
                      }
                      return this->z;
                     }
                     
                     if (this->y > this->z)
                         {
                          return this->y;
                         }
                         
                         return this->z;
                        }
}

when i do the same on windows, it works fine...

Ceniza

Just took your code and processed it through Source Formatter using different styles and it produces the right output.

Code::Blocks 3887 on Gentoo.

Icek

i have tried all of them, but no one worked right...

Ceniza

Create a new empty file, copy the wrongly formatted text of your post and paste it in that new file, now use the Source Formatter plugin. That's what I did and it worked that way.

Maybe a problem with new lines? (Just guessing)

Icek

hm, it works... but i have this problem with all files in my project... that isnt solution... couldnt be problem in ubuntu? why it works on win and on lin didnt ? with the same code...

Ceniza

#5
OK, it seems I found the problem: new lines.

I just took a file I created on Linux, used Source Formatter and it worked. Now I converted the file using unix2dos, opened it again, used Source Formatter and got something just like the code you pasted in your first post.

I'll try to find a way to fix that. I still need to update the plugin to a more recent version of AStyle anyway.

[edit]
OK, it's fixed now. Updated to AStyle 1.20.2 too.
[/edit]