diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-13 06:06:30 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-13 06:06:30 -0700 |
| commit | 792dcba600d1171feea39c44104832e6e6204c77 (patch) | |
| tree | 9d5a18d798e43b55dd4fca513d02c4366acef45c | |
| parent | 46487a4599d9c8154891c7dc78f5e539a687f1b7 (diff) | |
| parent | 5d93850df908863e44b3e132c82e07c6465ad4ea (diff) | |
| download | mruby-792dcba600d1171feea39c44104832e6e6204c77.tar.gz mruby-792dcba600d1171feea39c44104832e6e6204c77.zip | |
Merge pull request #128 from bovi/master
Code Convention Document
| -rw-r--r-- | doc/coding_conventions.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/coding_conventions.md b/doc/coding_conventions.md new file mode 100644 index 000000000..3d3d9d6f4 --- /dev/null +++ b/doc/coding_conventions.md @@ -0,0 +1,35 @@ +# Coding conventions + +How to style your C and Ruby code which you want to submit. + +## C code + +The core part (parser, bytecode-interpreter, core-lib, etc.) of mruby is written in the C programming language. Please note the following hints for your C code: + +### Comply with C99 (ISO/IEC 9899:1999) + +mruby should be highly portable to other systems and compilers. For that it is recommended to keep your code as close as possible to the C99 standard (http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf). + +### Reduce library dependencies to a minimum + +The dependencies to libraries should be put to an absolute minimum. This increases the portability but makes it also easier to cut away parts of mruby on-demand. + +### Don't use C++ style comments + + /* This is the prefered comment style */ + +### Insert a break after the method return value: + + int + main(void) + { + ... + } + +## Ruby code + +Parts of the standard library of mruby is written in the Ruby programming language itself. Please note the following hints for your Ruby code: + +### Comply with the Ruby standard (ISO/IEC 30170:2012) + +mruby is currently targeting to execute Ruby code which complies to ISO/IEC 30170:2012 (http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579).
\ No newline at end of file |
