• Home
  • Raw
  • Download

Lines Matching +full:lines +full:- +full:and +full:- +full:columns

1 <!--
4 SPDX-License-Identifier: curl
5 -->
11 single code base. Easy-to-read is an important property of code and helps
12 making it easier to review when new things are added and it helps debugging
17 Our C code has a few style rules. Most of them are verified and upheld by the
19 by the build system when built after `./configure --enable-debug` has been
23 need to copy the style already used in the source code and there are no
26 We also work hard on writing code that are warning-free on all the major
27 platforms and in general on as many platforms as possible. Code that obviously
28 causes warnings is not accepted as-is.
32 Try using a non-confusing naming scheme for your new functions and variable
35 understandable and be named according to what they are used for. File-local
39 how we name non-exported library-global symbols.
63 ## Long lines
65 Source code in curl may never be wider than 79 columns and there are two
66 reasons for maintaining this even in the modern era of large and high
69 1. Narrower columns are easier to read than wide ones. There is a reason
70 newspapers have used columns for decades or centuries.
72 2. Narrower columns allow developers to easier show multiple pieces of code
74 code windows next to each other on the same screen - as well as multiple
75 terminal and debugging windows.
80 the keyword and we then set the closing brace on the same indentation level as
89 You may omit the braces if they would contain only a one-line statement:
122 between the keyword and the open parenthesis. Like this:
133 pointer against NULL or != NULL and an int against zero or not zero in
146 To increase readability and reduce complexity of conditionals, we avoid
154 and instead we encourage the above version to be spelled out more clearly:
174 and NEVER:
184 [], ->, ., ++, --** and Unary **+, -, !, ~, &** operators excluded they should
194 size += -2 + 3 * (a + b);
195 ptr->member = a++;
196 struct.field = b--;
227 above. In such a case the statement spans multiple lines.
229 If a continuation line is part of an expression or sub-expression then you
231 the statement it is. Operators should not start continuation lines. In other
232 cases follow the 2-space indent guideline. Here are some examples from
236 if(Curl_pipeline_wanted(handle->multi, CURLPIPE_HTTP1) &&
237 (handle->set.httpversion != CURL_HTTP_VERSION_1_0) &&
238 (handle->set.httpreq == HTTPREQ_GET ||
239 handle->set.httpreq == HTTPREQ_HEAD))
240 /* did not ask for HTTP/1.0 and a GET or HEAD */
247 data->set.http_disable_hostname_check_before_authentication =
273 particular operating systems or hardware in the #ifdef lines. The HAVE_FEATURE
274 shall be generated by the configure script for unix-like systems and they are
275 hard-coded in the `config-[system].h` files for the others.
280 depending on a build-time conditional: