Jump to content

Recommended Posts

Posted

I want to cry every time I see how our code isn't uniform, each file/function uses a different code style.

It already was proposed before, but let's reconsider: We should normalize our source with astyle(http://astyle.sourceforge.net/).

We just have a problem, it will break all patches. What you guys think about it? And what style we should use, Allman? K&R?

Posted

I'm in favor of AStyle too, but when I tryed some function was getting quite long.

The better IDE I had to do this was codeblock, "format projet" using IDE, you'll see what I was talking about.

Posted

I vote for these Astyle options for trunk/src/:

# Brackets are broken from namespaces, classes, and function definitions. 
# Brackets are attached to statements within a function.
--style=kr

# Indent using tabs. Convert 4 spaces to 1 tab.
--indent=tab=4

# Indent 'class' and 'struct' blocks
--indent-classes

# Indent multi-line preprocessor definitions ending with a backslash.
--indent-preprocessor

# Indent comments beginning in column one.
--indent-col1-comments

# When a header is built of multiple lines, the lines will be aligned with the paren on the preceding line.
--min-conditional-indent=0

# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...).
--pad-header
# Remove extra space padding around parenthesis on the inside and outside.
--unpad-paren

# Don't break complex statements and multiple statements residing on a single line.
--keep-one-line-statements

#########################################################
# Which --align-pointer and --align-reference options?
#########################################################

# Do not retain a backup of the original file. (your working copy has SVN History)
--suffix=none

# For each directory in the command line, process all subdirectories recursively.
--recursive

Also, some previous discussion: (rough draft) Scripting & Coding Style Guidelines and User:Gepard/Sandbox.

  • Upvote 1
Posted

My parameter list:

--style=kr
--align-pointer=name
--align-reference=name
--mode=c
--lineend=linux
--convert-tabs
--keep-one-line-statements
--min-conditional-indent=0
--pad-header
--unpad-paren
--indent-col1-comments
--indent-preprocessor
--indent-labels
--indent-cases
--indent-switches
--indent=spaces=4
--suffix=none
--max-instatement-indent=80
--recursive

@edit

It is reducing the file size better thant I thought it would.

Also, a diff for atcommand.c so you can see how it would look like: atcommand.c.patch

went from 283kb to 275kb

@edit2

I uploaded the files already on astyle to a github repo so you can see for yourselves.

https://github.com/mkbu95/rathena_src_astyle

Posted

@GreenBox: was the conversion of indents from tabs to spaces intentional?

I want to cry every time I see you guys using spaces everywhere to indent while like 98% of source use tab :P

I also voted for tab indents /rice

# Indent using tabs. Convert 4 spaces to 1 tab.
--indent=tab=4

  • Upvote 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...