Codingstyle

Hi,

Can we agree on some coding style rules please?
My main gripe is the usage of TABs, when they don’t
mean width of 8.–
Kees (goes in hiding)

Hi,

Can we agree on some coding style rules please?
My main gripe is the usage of TABs, when they don’t
mean width of 8.

Kees (goes in hiding)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Really ? Nice troll.

If you are being oddly serious:

So far, the best I’ve seen on dealing with white space and coding convention
stuff is to insist on the use of indent or similar. This way you can
check it out, indent it to your desired style, edit, then pass back through
indent so it matches the project’s profile before submitting. I’m unsure,
but surely there’s version control stuff that takes all checkins and
sanitizes them in this way to begin with ?

And I will say – if someone tries to force me to work within a style that
is akin to gnu c style (and they don’t provide an indent profie)… I will
run to every living thing I see and inflict grievous cavity harm to it until
it dies.

-WillOn Thu, Mar 10, 2011 at 4:51 PM, Kees Bakker <kees.bakker at xs4all.nl> wrote:

I laugh so hard when I see people cry about coding styles… Like your
style is the only correct way to code. Give me a break, the egocentric
attitude is everywhere in coding… sickening

Rant over.On 3/10/2011 5:08 PM, Will Langford wrote:

On Thu, Mar 10, 2011 at 4:51 PM, Kees Bakker <kees.bakker at xs4all.nl <mailto:kees.bakker at xs4all.nl>> wrote:

Hi,

Can we agree on some coding style rules please?
My main gripe is the usage of TABs, when they don't
mean width of 8.
--
Kees (goes in hiding)

_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Really ? Nice troll.

If you are being oddly serious:

So far, the best I’ve seen on dealing with white space and coding
convention stuff is to insist on the use of indent or similar. This
way you can check it out, indent it to your desired style, edit, then
pass back through indent so it matches the project’s profile before
submitting. I’m unsure, but surely there’s version control stuff that
takes all checkins and sanitizes them in this way to begin with ?

And I will say – if someone tries to force me to work within a style
that is akin to gnu c style (and they don’t provide an indent
profie)… I will run to every living thing I see and inflict grievous
cavity harm to it until it dies.

-Will


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well, I personally find the “wrong” coding style very annoying for practical
reasons (I rely on actual tabs for fast navigation, for example; spaces get on
my nerves) - but why whine about it? There are lots of tools that can
transform and reformat as needed if it’s that important.

Naming conventions and that sort of stuff is actually important to some extent

  • but concistency is more important than the actual style.On Friday 11 March 2011, at 01.19.23, “Mars_999” wrote:

I laugh so hard when I see people cry about coding styles… Like your
style is the only correct way to code. Give me a break, the egocentric
attitude is everywhere in coding… sickening

Rant over.


//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://consulting.olofson.net http://olofsonarcade.com |
’---------------------------------------------------------------------’

I laugh so hard when I see people cry about coding styles… Like your
style is the only correct way to code. Give me a break, the egocentric
attitude is everywhere in coding… sickening

Rant over.

Hence my initial ‘Nice troll’ response :slight_smile:

I’m a strong believer in indent and similar code formatting tools. This way
everyone can format the code however they want. If you have to write a
non-trivial patch against a code base that isn’t formatted in your style, it
can be extremely tedious to write in the original style of the project. So
much so that the code formatting takes more effort than the code itself.

For instance, I have an ‘ANSI’ style indentation preference (and not sure
about blank line / spaces around parenthesis name if any). Writing a 5k
line patch against a gnu stylized project would be a nightmare for me
without formatting tools.

Granted, I’ve only run across the unique coding style ‘problem’ in maybe a
handful of projects over the years, and were typically started by coders who
hailed from varied backgrounds (ie: over the years one guy started in
pascal, then moved to tasm, then visual c, and then into linux which
produced an interesting layout style. At first glance it looked like 1st
year comp sci student, but it was very uniform over the entire project).

As David mentioned concerning naming convention: consistency is the only
truly important thing (IMHO). Assuming it’s not consistently chaotic hehe.

For what it’s worth, I’m content with SDL’s naming convention. I am also
content with it’s white spacing style (generally not a problem in the couple
editors I use).

-WillOn Thu, Mar 10, 2011 at 6:19 PM, Mars_999 wrote:

Can we agree on some coding style rules please?

I doubt that will happen unless Sam lays down some rules.

My main gripe is the usage of TABs, when they don’t
mean width of 8.

I use tabs for pretty much the same reasons as David mentioned, but I have my
editor set tab width to equal 3 spaces for better readability. Works for me.

JeffOn Thursday 10 March 2011 14:51, Kees Bakker wrote:

What? You mean it’s not? Oh, crud…

:slight_smile: JeffOn Thursday 10 March 2011 16:19, Mars_999 wrote:

I laugh so hard when I see people cry about coding styles… Like your
style is the only correct way to code.

Please calm down.

First let me say: indent is not a synonym for TAB. If you’re not willing
to see that, then we can stop the discussion here.

In your reply you actually mention something that I think is crucial to
the issue. You say: “(and they don’t provide an indent profie)”, you
probably mean “profile”. If so, then that’s the whole point. If you load
a source in your favorite editor, you also need to know what the intended
TAB width is. That’s why you see this is most of the source files.
/* vi: set ts=4 sw=4 expandtab: */
The reality is: there is not always a profile.

I’m guessing we have many contributors, with very different development
environments. Some people fill up an indent with spaces, some with TABs
and some don’t care. Some people have indent size 4, some have 8, or 3
or whatever. If you mix it all together it becomes a mess. I just want
to see some consistency.

Here is how you can tell: grab a source file and print it with (Linux) lpr.
(Or Notepad on Windows, or TextEditor on Mac.) Have a look at the layout.On Friday 11 March 2011, Will Langford wrote:

On Thu, Mar 10, 2011 at 4:51 PM, Kees Bakker <@Kees_Bakker> wrote:

Hi,

Can we agree on some coding style rules please?
My main gripe is the usage of TABs, when they don’t
mean width of 8.

Kees (goes in hiding)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Really ? Nice troll.

If you are being oddly serious:

So far, the best I’ve seen on dealing with white space and coding convention
stuff is to insist on the use of indent or similar. This way you can
check it out, indent it to your desired style, edit, then pass back through
indent so it matches the project’s profile before submitting. I’m unsure,
but surely there’s version control stuff that takes all checkins and
sanitizes them in this way to begin with ?

And I will say – if someone tries to force me to work within a style that
is akin to gnu c style (and they don’t provide an indent profie)… I will
run to every living thing I see and inflict grievous cavity harm to it until
it dies.

-Will


Kees

This really isn’t the mailing list to discuss the "proper coding style."
There are other places on the internet to discuss that, but we’re more
focused on developing SDL and it’s respective applications.
Please take the discussion elsewhere.On Fri, Mar 11, 2011 at 6:04 AM, Kees Bakker <kees.bakker at xs4all.nl> wrote:

On Friday 11 March 2011, Will Langford wrote:

On Thu, Mar 10, 2011 at 4:51 PM, Kees Bakker <kees.bakker at xs4all.nl> wrote:

Hi,

Can we agree on some coding style rules please?
My main gripe is the usage of TABs, when they don’t
mean width of 8.

Kees (goes in hiding)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Really ? Nice troll.

If you are being oddly serious:

So far, the best I’ve seen on dealing with white space and coding
convention
stuff is to insist on the use of indent or similar. This way you can
check it out, indent it to your desired style, edit, then pass back
through
indent so it matches the project’s profile before submitting. I’m
unsure,
but surely there’s version control stuff that takes all checkins and
sanitizes them in this way to begin with ?

And I will say – if someone tries to force me to work within a style
that
is akin to gnu c style (and they don’t provide an indent profie)… I
will
run to every living thing I see and inflict grievous cavity harm to it
until
it dies.

-Will

Please calm down.

First let me say: indent is not a synonym for TAB. If you’re not willing
to see that, then we can stop the discussion here.

In your reply you actually mention something that I think is crucial to
the issue. You say: “(and they don’t provide an indent profie)”, you
probably mean “profile”. If so, then that’s the whole point. If you load
a source in your favorite editor, you also need to know what the intended
TAB width is. That’s why you see this is most of the source files.
/* vi: set ts=4 sw=4 expandtab: */
The reality is: there is not always a profile.

I’m guessing we have many contributors, with very different development
environments. Some people fill up an indent with spaces, some with TABs
and some don’t care. Some people have indent size 4, some have 8, or 3
or whatever. If you mix it all together it becomes a mess. I just want
to see some consistency.

Here is how you can tell: grab a source file and print it with (Linux) lpr.
(Or Notepad on Windows, or TextEditor on Mac.) Have a look at the layout.

Kees


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

This really isn’t the mailing list to discuss the "proper coding style."
There are other places on the internet to discuss that, but we’re more
focused on developing SDL and it’s respective applications.
Please take the discussion elsewhere.

Alex, I think you missed the point of the conversation. No one has suggested
or started a coding style flame war (although, I suppose my comments could
be construed as such).

Kees seems to simply want to suggest that the SDL top dogs pick a style and
publish it.

I think it’s a great idea no matter what style they choose.

Is it overtly important - I dunno. It should compile the same no matter
what style is used. I would also think (not know, but think) that a
published profile would make submitting patches easier as well due to easier
diff’ing.

-WillOn Fri, Mar 11, 2011 at 7:22 AM, Alex Barry <alex.barry at gmail.com> wrote:

This really isn’t the mailing list to discuss the “proper coding style.” There are other places on the internet to discuss that, but we’re more focused on developing SDL and it’s respective applications.
Please take the discussion elsewhere.

Alex, I think you missed the point of the conversation. No one has suggested or started a coding style flame war (although, I suppose my comments could be construed as such).

Kees seems to simply want to suggest that the SDL top dogs pick a style and publish it.

I think it’s a great idea no matter what style they choose.

Is it overtly important - I dunno. It should compile the same no matter what style is used. I would also think (not know, but think) that a published profile would make submitting patches easier as well due to easier diff’ing.

-Will

Thanks Will.On 11 Mar, 2011, at 21:33 , Will Langford wrote:

On Fri, Mar 11, 2011 at 7:22 AM, Alex Barry <alex.barry at gmail.com> wrote:

Kees

My theory on coding styles for projects is that there are always a large number of contributors unhappy with any particular style that is chosen by the project leads.

Since contributors are always wanted and welcomed, it’s best not to give them any trouble over their chosen style, as such I choose not to enforce any coding style rules in my projects.

If the project leads wish to enforce a coding style, it can be enforced by reformatting the code at major milestones (release tags) using a suitable tool, perhaps?–
LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

My theory on coding styles for projects is that there are always a large
number of contributors unhappy with any particular style that is chosen by
the project leads.

Since contributors are always wanted and welcomed, it’s best not to give
them any trouble over their chosen style, as such I choose not to enforce
any coding style rules in my projects.

If the project leads wish to enforce a coding style, it can be enforced by
reformatting the code at major milestones (release tags) using a suitable
tool, perhaps?

I was going to suggest the latter as well. Compiling a milestone, then
passing the code through a beautifier and recompiling, then making sure the
hashes for both binaries match is easy enough. As Kees has pointed out (and
I’ve noted from personal experience), a completely chaotic tree can also be
as discouraging as nazi stylists.

I’ve also contributed to a few projects where contributions from anyone was
welcome, but there was some strict maintainers. The maintainers would take
my patch, apply it, pass it through their chosen beautifier, and then post
their version of the diff (keeping my name as the contributor etc).
Speaking of which, I really should get away from closed source projects
heh.

Having not bothered to look for updated beautifiers in years (around 2000
?), I will say that uncrustify looks interesting.
http://uncrustify.sourceforge.net/

-WillOn Fri, Mar 11, 2011 at 5:01 PM, Forest Hale wrote: