|
|
@@ -0,0 +1,45 @@
|
|
|
+.TH "INTI C CODING STYLE" 1 "14 Jan 21"
|
|
|
+.SH INTRODUCTION
|
|
|
+This is the inti C Language Coding Style standard. Everybody in the inti (inti's not interpreters) should
|
|
|
+read this carefully and use it in their code which will commit to inti softwares.
|
|
|
+
|
|
|
+Most of this standard copies from K&R (THE C PROGRAMMING LANGUAGE), but some of them are different.
|
|
|
+
|
|
|
+.SH NAMES
|
|
|
+\fBALWAYS\fP use names with '_' and \fBNEVER\fPuse NamesLikeThis. We use names like both BSD and linux, but
|
|
|
+\fBNEVER\fP like Windows! Remember that here is C, not Java or other. And here is UNIX, not Windows. :-)
|
|
|
+
|
|
|
+For some long words such as \fBattribute\fP and \fBsystem\fP, you should make them short and let them look
|
|
|
+like \fBattr\fP and \fBsys\fP.
|
|
|
+
|
|
|
+And if the name is not so long, don't use '_' to split. This is what we usually do in BSD and POSIX.
|
|
|
+
|
|
|
+And, don't use some stupid words such as 'my' --- it makes your code dirty :-)
|
|
|
+
|
|
|
+\fBGOOD\fP: \fBi\fP, \fBp\fP, \fBname\fP, \fBp\fP, \fBattrmask\fP
|
|
|
+
|
|
|
+\fBBAD\fP: \fBattribute_mask\fP, \fBerror_number\fP, \fBget_my_name\fP
|
|
|
+
|
|
|
+\fBBADEST\fP: \fBIsSuccess\fP, \fBNameOfEveryStudent\fP, \fBMyStudentIdentify\fP
|
|
|
+
|
|
|
+.SH TABS
|
|
|
+\fBALWAYS\fP use tab8 instead of spaces. Right, spaces are more easy to port but it makes code big. And
|
|
|
+I think tab is a tradition of C, is that okay?
|
|
|
+
|
|
|
+.SH DECLARES
|
|
|
+You can use tabs after types and you can also don't. These are okay:
|
|
|
+
|
|
|
+\fBGOOD\fP: \fBint id;\fP
|
|
|
+ \fBchar *name;\fP
|
|
|
+
|
|
|
+\fBGOOD\fP: \fBint id\fP
|
|
|
+ \fBchar *name\fP
|
|
|
+
|
|
|
+Before, I didn't use tabs after types because my first was python and it brings me a lot such as '{}' at
|
|
|
+end of line and don't use tabs. But after reading the tyt code from linux 0.0.1, I relize it is more beatiful
|
|
|
+and I start to try. You can use tabs, but you should use them at the right place.
|
|
|
+
|
|
|
+.SH '{}'s
|
|
|
+You can use them as you want, but \fBNEVER\fP put '{}'s at next line after \fBif\fP or \fBwhile\fP etc.
|
|
|
+
|
|
|
+
|