sudoc:su_prog_rules
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sudoc:su_prog_rules [2019/07/30 21:46] – seisunix | sudoc:su_prog_rules [2019/07/30 21:55] (current) – seisunix | ||
---|---|---|---|
Line 33: | Line 33: | ||
===== Avoid using global variables ===== | ===== Avoid using global variables ===== | ||
If you need to pass a variable to a subroutine then pass it as an argument to the subroutine, do not define it as a global variable. | If you need to pass a variable to a subroutine then pass it as an argument to the subroutine, do not define it as a global variable. | ||
+ | |||
+ | ===== Document your code thoroughly ===== | ||
+ | Make sure there are Notes: in the Self Documentation. | ||
+ | Document each declared variable. Put technical information describing the algorithm being used. Remember that " | ||
+ | |||
+ | Document subroutines as though they will be clipped out and put in a library---because if a subroutine is useful, it will be separated from its parent program. | ||
+ | |||
+ | Pretend that the code will not run without the documentation. | ||
===== Develop from existing code ==== | ===== Develop from existing code ==== | ||
Line 254: | Line 262: | ||
} | } | ||
if (icount==0) warn(" | if (icount==0) warn(" | ||
+ | </ | ||
+ | ** Dynamic allocation which hides " | ||
+ | < | ||
/* Allocate fft arrays */ | /* Allocate fft arrays */ | ||
Line 264: | Line 275: | ||
polygonalFilter(f, | polygonalFilter(f, | ||
+ | </ | ||
+ | |||
+ | ** note that most of the time we loop over input traces, these are in "do -- while" loops ** | ||
+ | < | ||
/* Main loop over traces */ | /* Main loop over traces */ | ||
do { | do { | ||
Line 375: | Line 390: | ||
</ | </ | ||
- |
sudoc/su_prog_rules.txt · Last modified: 2019/07/30 21:55 by seisunix