X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=docs%2Fcomm%2Frts-libs%2Fcoding-style.html;fp=docs%2Fcomm%2Frts-libs%2Fcoding-style.html;h=0000000000000000000000000000000000000000;hp=58f5b4f9bb485f448ae1e10f2884821c0e142cc2;hb=82af8c0af70a1f72d5c364d35d04eef17d88395d;hpb=abcf8d64e9d687e015f7f50938b4cd006f277114 diff --git a/docs/comm/rts-libs/coding-style.html b/docs/comm/rts-libs/coding-style.html deleted file mode 100644 index 58f5b4f..0000000 --- a/docs/comm/rts-libs/coding-style.html +++ /dev/null @@ -1,516 +0,0 @@ - - - - - The GHC Commentary - Style Guidelines for RTS C code - - - -

The GHC Commentary - Style Guidelines for RTS C code

- -

Comments

- -

These coding style guidelines are mainly intended for use in -ghc/rts and ghc/includes. - -

NB These are just suggestions. They're not set in stone. Some of -them are probably misguided. If you disagree with them, feel free to -modify this document (and make your commit message reasonably -informative) or mail someone (eg. The GHC mailing list) - -

References

- -If you haven't read them already, you might like to check the following. -Where they conflict with our suggestions, they're probably right. - - - - -

Portability issues

- - - -

Debugging/robustness tricks

- - -Anyone who has tried to debug a garbage collector or code generator -will tell you: "If a program is going to crash, it should crash as -soon, as noisily and as often as possible." There's nothing worse -than trying to find a bug which only shows up when running GHC on -itself and doesn't manifest itself until 10 seconds after the actual -cause of the problem. - -

We put all our debugging code inside #ifdef DEBUG. The -general policy is we don't ship code with debugging checks and -assertions in it, but we do run with those checks in place when -developing and testing. Anything inside #ifdef DEBUG should -not slow down the code by more than a factor of 2. - -

We also have more expensive "sanity checking" code for hardcore -debugging - this can slow down the code by a large factor, but is only -enabled on demand by a command-line flag. General sanity checking in -the RTS is currently enabled with the -DS RTS flag. - -

There are a number of RTS flags which control debugging output and -sanity checking in various parts of the system when DEBUG is -defined. For example, to get the scheduler to be verbose about what -it is doing, you would say +RTS -Ds -RTS. See -includes/RtsFlags.h and rts/RtsFlags.c for the full -set of debugging flags. To check one of these flags in the code, -write: - -

-  IF_DEBUG(gc, fprintf(stderr, "..."));
-
- -would check the gc flag before generating the output (and the -code is removed altogether if DEBUG is not defined). - -

All debugging output should go to stderr. - -

-Particular guidelines for writing robust code: - -

- -

Syntactic details

- - - -

CVS issues

- - - - - -