Changes between Version 37 and Version 38 of HowTo/FortranStandards
- Timestamp:
- 2013-06-25T14:09:46+02:00 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
HowTo/FortranStandards
v37 v38 265 265 266 266 (1) Try to keep non-header lines to 80 characters or less, although this is not a hard limit. 267 267 268 (2) Put Fortran keywords and intrinsic functions in all uppercase letters. 269 268 270 (3) Do not use tab characters, as a mix of tab characters and spaces makes for terrible formatting portability. As noted above, tab in emacs is fine, since it actually uses spaces. 271 269 272 (4) Five arguments per line as a soft guideline for subroutine and function calls/declaration (soft guideline meaning it's not the end of the world if sometimes four or six are used). 273 270 274 (5) Include IMPLICIT NONE in module declarations. 275 271 276 (6) Always use INTENT statements for arguments. 277 272 278 (7) Never use "magic numbers", i.e. hard-coded numbers that cannot be traced to a literature formula. Externalization helps a lot with this. 279 273 280 (8) Be mindful of loop ordering for best memory access (performance). In other words, 274 281 … … 284 291 285 292 }}} 293 286 294 This ensures that one accesses continginuos memory blocks during the loop, which makes it faster. I saw this in an optimization course back in 2004, as well, but it seems to not always be done in ORCHIDEE. Have compilers just gotten better? Some people have also suggested a guideline for the loops (i.e., loop over points first, then PFT, then nparts, etc.), since this also does not seem consistent. 287 295