Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old July 17, 2021, 19:23   #11
MITZE
Adept
 
Join Date: Jan 2017
Location: Pennsylvania, United States
Posts: 214
MITZE is on a distinguished road
Perhaps a dumb question (if I understand properly what's being conveyed anyway), but why the "tabs of four spaces" convention?
__________________
Everything you need to know about my roguelike playstyle:

I took nearly two years to win with a single character in PosChengband.
MITZE is offline   Reply With Quote
Old July 17, 2021, 20:39   #12
Marble Dice
Swordsman
 
Join Date: Jun 2008
Location: Portland, OR, USA
Posts: 412
Marble Dice is on a distinguished road
Quote:
Originally Posted by MITZE View Post
Perhaps a dumb question (if I understand properly what's being conveyed anyway), but why the "tabs of four spaces" convention?
That's just a recommendation to set your editor to display tabs as 4 spaces, as your tab display width also has a (usually minor) impact on where you break lines.
Marble Dice is offline   Reply With Quote
Old July 17, 2021, 23:44   #13
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,163
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Quote:
Originally Posted by Marble Dice View Post
That's actually a really good start, and about what I would have expected from looking at the code.
I think it's probably originally written by takkaria, or maybe Antony Sidwell; it's what I've been working off since I started V development.

Quote:
Originally Posted by Marble Dice View Post
I agree with almost all of the recommendations, but the one thing I'd really like to see changed is the 80 character line limit. Even my ancient 17" monitor can easily display up to 150 characters with multiple panes open. I'm not saying we have to go through and reformat everything but increasing the line-wrap recommendation to 120 or even 100 would make a world of difference. With a few indents in the mix, it can get hard to wrap lines in an clear and aesthetically pleasing location at 80 characters.
My gut agrees with Julian on this one, but I don't know how much of that is just habit (there's a joke about going to great lengths here...). In many ways it would be easier to have a bit more line length to play with, and there is certainly the odd line which goes over 80 - mainly to not break quoted strings. Not sure, more discussion needed.

Quote:
Originally Posted by Marble Dice View Post
One other thing I've noticed is there seems to be a preference for inline /* block-style */ comments instead of // single line comments. The block-style comments make sense for function headers, but I find the // comments much easier to work with for inline comments. Is this actually a project preference or just what's happened?
I think it has been expressed as a project preference in the past, and I'm inclined to stick with it, mostly at least. I use // mainly to temporarily comment out code or for other things I'm tentative about, so doing a search for it enables me to find where something temporary has accidentally become permanent, or (as in some cases in obj-info.c) where there is something I'm not happy about that I want to do better. I'm inclined to write it into the document as a strong preference.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old July 18, 2021, 05:52   #14
Marble Dice
Swordsman
 
Join Date: Jun 2008
Location: Portland, OR, USA
Posts: 412
Marble Dice is on a distinguished road
Quote:
Originally Posted by Nick View Post
In many ways it would be easier to have a bit more line length to play with, and there is certainly the odd line which goes over 80 - mainly to not break quoted strings. Not sure, more discussion needed.
I'll follow the convention of course but if it's okay to go past 80 "just a little bit" when you "feel like it" then that's not really much of a convention. Obviously line wrapping is important, but that's exactly why I want a little more room - to make the most readable blocks of code. I'll just pretend I didn't notice I had 85 characters on that line unless you call me out on it.

Quote:
Originally Posted by Nick View Post
I think it has been expressed as a project preference in the past, and I'm inclined to stick with it, mostly at least. ... write it into the document as a strong preference.
I think a convention is good for consistency, and I certainly wouldn't use // with as one-sided as the source currently is. I count 102 instances of // and 18,941 instances of /*.
Marble Dice is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Angband Coding Style calris Development 37 April 30, 2016 08:08
some more questions about coding Malak Darkhunter Vanilla 16 January 3, 2012 05:52
more variant coding woes will_asher Variants 1 February 10, 2011 06:18
Angband coding question will_asher Variants 10 September 3, 2008 23:03
Coding standard? Indentation? Bandobras Vanilla 10 May 24, 2008 20:46


All times are GMT +1. The time now is 13:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.