From acdfc94511985c5c4369fc650c9f3bb3773dc2e3 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 16 Oct 2016 22:06:20 -0700 Subject: [PATCH] Merge prog_std.txt into coding_style.md --- Makefile.am | 2 +- coding_style.md | 17 ++++++++++++++++- prog_std.txt | 41 ----------------------------------------- readme.txt | 2 +- 4 files changed, 18 insertions(+), 44 deletions(-) delete mode 100644 prog_std.txt diff --git a/Makefile.am b/Makefile.am index 84a6eb47..e664bdbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 AM_DISTCHECK_CONFIGURE_FLAGS = --without-systemdsystemunitdir EXTRA_DIST = bootstrap COPYING coding_style.md design.txt faq-compile.txt \ - faq-general.txt file-loc.txt install.txt m4 prog_std.txt readme.txt + faq-general.txt file-loc.txt install.txt m4 readme.txt if XRDP_NEUTRINORDP NEUTRINORDPDIR = neutrinordp diff --git a/coding_style.md b/coding_style.md index 584dac78..cf096ac8 100644 --- a/coding_style.md +++ b/coding_style.md @@ -15,6 +15,13 @@ Here is how we run the astyle command: This coding style is a work in progress and is still evolving. +Language Standard +----------------- + +Try to make all code compile with both C and C++ compiler. C++ is more +strict, which makes the code safer. + + Indentation ----------- @@ -32,7 +39,7 @@ Indentation Line wrapping ------------- -* Keep lines shorter than 80 chars +* Keep lines not longer than 80 chars * Align wrapped argument to the first argument ☞ @@ -46,9 +53,11 @@ Variable names * Use lowercase with underscores as needed * Don't use camelCase +* Preprocessor constants should be uppercase ☞ + #define BUF_SIZE 1024 int fd; int bytes_in_stream; @@ -193,3 +202,9 @@ Braces default: printf("bad cmd\n"); } + +Comments +-------- + +Use /* */ for comments +Don't use // diff --git a/prog_std.txt b/prog_std.txt deleted file mode 100644 index 761006a5..00000000 --- a/prog_std.txt +++ /dev/null @@ -1,41 +0,0 @@ - -This is an attempt to explain my odd programming standard used for this project. -Not to defend any of these but it's my default standard and it makes it easy -for me to read code. - -Some files break these rules, they will be updated eventually. - -try to make any file compile with c++ compilers - -always put one var on a line by itself - char* pvar; - char text[256]; -not - char *pvar, text[256]; - -function calls look like this - foo(a, b, c); -not - foo ( a, b, c ); - -while, if, and case statements look like - while (i != 0) -not - while(i != 0) - -for comments, always use /* */, not // - -defines should always be uppercase - -don't use tabs, use spaces - -no line should exceed 80 chars - -always use {} in if and while, even if it's only one line - while (p != 0) - { - p = p->next; - } -not - while (p != 0) - p = p->next; diff --git a/readme.txt b/readme.txt index b051ef02..df9d92f0 100644 --- a/readme.txt +++ b/readme.txt @@ -21,7 +21,7 @@ xup is a module used to connect to an rdp specific X11 server Xserver is the files needed to build an rdp specific X11 server COPYING is the license file design.txt is an attempt to explain the project design -prog_std.txt is an attempt to explain the programming standard used +coding_style.md describes the coding style for the project since version 0.5.0 we switch to autotools to build xrdp