Code formatting rules

Adam Goode agoode at andrew.cmu.edu
Tue May 11 15:56:49 EDT 2010


On 05/11/2010 02:53 PM, Hauke Heibel wrote:
> Hi Adam,
> 
> I just wanted to ask regarding coding conventions and formatting.
> 
> - do you prefer tabs or white spaces? currently it is mixed within your code.
> - in case you indent with white spaces, what is your indent depth? 2
> or 4? or maybe 3?
> 
> Here is what I've recognized so far. Pointer declarations are attached
> to the variable name. You seem to prefer declaring struct variables
> explicitly as opposed to using typedefs. And opening curly braces stay
> in the line of the declaration/definition.
> 
> Well, that is not much. I was just curious and I don't want to
> reformat code and make you feel uncomfortable reading it...
> 

Hi Hauke,

I am not as careful as I should be regarding whitespace. I typically use
the default emacs indentation for C. What you have been doing so far is
fine, I think.

The thing to do is just try to avoid reformatting whitespace inside
another commit. If you (or I) reformat whitespace, it's best to put all
of that into a single commit so that it can be easily ignored if necessary.

You can try running this indent command after you make changes if you
want, I think it gives a good approximation to the style I use, though
it is not perfect:

indent -brf -npsl -npcs -br -ce



Adam


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20100511/ebcfb5e3/attachment.bin 


More information about the openslide-users mailing list