Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 122666857b09d5dd5a74b936ef9efa1c > files > 26

sigscheme-0.8.5-1.fc14.x86_64.rpm

Coding style
============

Cosmetic style
--------------

C:
----------------------------------------------------------------
indent-tabs-mode: nil
fill-column: 79
c-basic-offset: 4
substatement-open: 0
c-backslash-column: 77
----------------------------------------------------------------

Scheme:
----------------------------------------------------------------
(put 'and-let* 'scheme-indent-function 1)
(put 'receive 'scheme-indent-function 2)
(put 'with-exception-handler 'scheme-indent-function 1)
(put 'guard 'scheme-indent-function 1)
----------------------------------------------------------------

The value 77 for c-backslash-column is selected to maximize writable space,
eliminate jagged end of lines and prevent overflow of lines on diffs posted
to the uim-commit list.

Avoid placing a character at column 80 even if your editor displays it
without overflow in 80-column window. Many editor displays it as continuance
mark or folding mark. i.e. Treat column 79 as end-of-line, especially for
decorations for comments.


Macro definition
----------------

Any argument should be wrapped into () or [] if no exceptional reason exist,
to prevent unintended operator associations.

[C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define SCM_CONS_SET_CAR(a, car)   (SCM_CAR(a) = (car))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And ultra-cowardively, passing an argument to another function or macro is
should also be wrapped as follows.

[C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define SCM_CONS(kar, kdr) (Scm_NewCons((kar), (kdr)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is intended to ensure unconditional safety against rare-cases such as
follows.

[C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define FOO assert(), get_foo()
#define MAKE_LIST2(x, y) make_list(x, y)

MAKE_LIST2(FOO, SCM_FALSE);
/* => make_list(assert(), get_foo(), SCM_FALSE) */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Macro invocation
----------------

Don't pass a destructive or side-effective expression to a SigScheme macro as
an argument (e.g. `CONTINUATIONP(continuation_stack_unwind(cont))`), because
there's an possibility that continuation_stack_unwind() is evaluated multiple
times after the macro expantion.