Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C style guide tips for a <80 char line

Tags:

c

coding-style

I can't find many recommendations/style guides for C that mention how to split up lines in C so you have less then 80 characters per line.

About the only thing I can find is PEP 7, the style guide for the main Python implmentation (CPython).

Does a link exist to a comprehensive C style guide which includes recommendations for wrapping?

Or failing that, at least some good personal advive on the matter?

P.S.: What do you do with really_long_variable_names_that_go_on_forever (besides shortening)? Do you put them on the left edge or let it spill?

like image 339
Roman A. Taycher Avatar asked Jan 20 '23 14:01

Roman A. Taycher


2 Answers

Here is Linus'original article about (linux) kernel coding style. The document probably evolved since, it is part of the source distribution.

like image 158
Jens Gustedt Avatar answered Jan 30 '23 09:01

Jens Gustedt


You can have a look at the GNU Coding Standards which covers much more than coding style, but are pretty interesting nonetheless.

like image 26
Xavier T. Avatar answered Jan 30 '23 08:01

Xavier T.