comparison runtime/doc/develop.txt @ 7707:41768bcebc9b

commit https://github.com/vim/vim/commit/13d5aeef56e3140a8eb8f40c7062aa1c5700f76e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 21 23:36:05 2016 +0100 Update runtime files
author Christian Brabandt <cb@256bit.org>
date Thu, 21 Jan 2016 23:45:07 +0100
parents c52a655d927d
children 93f747af7b58
comparison
equal deleted inserted replaced
7706:dd457970efc8 7707:41768bcebc9b
1 *develop.txt* For Vim version 7.4. Last change: 2014 Mar 27 1 *develop.txt* For Vim version 7.4. Last change: 2016 Jan 19
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
164 164
165 165
166 MAKING CHANGES *style-changes* 166 MAKING CHANGES *style-changes*
167 167
168 The basic steps to make changes to the code: 168 The basic steps to make changes to the code:
169 1. Adjust the documentation. Doing this first gives you an impression of how 169 1. Get the code from github. That makes it easier to keep your changed
170 version in sync with the main code base (it may be a while before your
171 changes will be included). You do need to spend some time learning git,
172 it's not the most user friendly tool.
173 2. Adjust the documentation. Doing this first gives you an impression of how
170 your changes affect the user. 174 your changes affect the user.
171 2. Make the source code changes. 175 3. Make the source code changes.
172 3. Check ../doc/todo.txt if the change affects any listed item. 176 4. Check ../doc/todo.txt if the change affects any listed item.
173 4. Make a patch with "diff -c" against the unmodified code and docs. 177 5. Make a patch with "git diff". You can also create a pull request on
174 5. Make a note about what changed and include it with the patch. 178 github, but it's the diff that matters.
179 6. Make a note about what changed, preferably mentioning the problem and the
180 solution. Send an email to the vim-dev maillist with an explanation and
181 include the diff. Or create a pull request on github.
182
183
184 C COMPILER *style-compiler*
185
186 The minimal C compiler version supported is C89, also known as ANSI C.
187 Later standards don't add much and C89 is the widest supported.
188
189 One restriction that this implies: no // comments, only /* comments */.
175 190
176 191
177 USE OF COMMON FUNCTIONS *style-functions* 192 USE OF COMMON FUNCTIONS *style-functions*
178 193
179 Some functions that are common to use, have a special Vim version. Always 194 Some functions that are common to use, have a special Vim version. Always
195 210
196 NAMES *style-names* 211 NAMES *style-names*
197 212
198 Function names can not be more than 31 characters long (because of VMS). 213 Function names can not be more than 31 characters long (because of VMS).
199 214
200 Don't use "delete" as a variable name, C++ doesn't like it. 215 Don't use "delete" or "this" as a variable name, C++ doesn't like it.
201 216
202 Because of the requirement that Vim runs on as many systems as possible, we 217 Because of the requirement that Vim runs on as many systems as possible, we
203 need to avoid using names that are already defined by the system. This is a 218 need to avoid using names that are already defined by the system. This is a
204 list of names that are known to cause trouble. The name is given as a regexp 219 list of names that are known to cause trouble. The name is given as a regexp
205 pattern. 220 pattern.
286 301
287 OK: do 302 OK: do
288 a = 1; 303 a = 1;
289 while (cond); 304 while (cond);
290 305
306 Wrong: if (cond) {
307 cmd;
308 cmd;
309 } else {
310 cmd;
311 cmd;
312 }
313
314 OK: if (cond)
315 {
316 cmd;
317 cmd;
318 }
319 else
320 {
321 cmd;
322 cmd;
323 }
291 324
292 Functions start with: 325 Functions start with:
293 326
294 Wrong: int function_name(int arg1, int arg2) 327 Wrong: int function_name(int arg1, int arg2)
295 328
297 * Explanation of what this function is used for. 330 * Explanation of what this function is used for.
298 * 331 *
299 * Return value explanation. 332 * Return value explanation.
300 */ 333 */
301 int 334 int
302 function_name(arg1, arg2) 335 function_name(
303 int arg1; /* short comment about arg1 */ 336 int arg1, /* short comment about arg1 */
304 int arg2; /* short comment about arg2 */ 337 int arg2) /* short comment about arg2 */
305 { 338 {
306 int local; /* comment about local */ 339 int local; /* comment about local */
307 340
308 local = arg1 * arg2; 341 local = arg1 * arg2;
309 342