From 5933f0292a0b43484a9f7714a89f20c2318f9b1e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 26 Apr 2017 19:22:55 -0500 Subject: [PATCH] Updated DNE Coding Standards (mediawiki) --- DNE-Coding-Standards.mediawiki | 1 + 1 file changed, 1 insertion(+) diff --git a/DNE-Coding-Standards.mediawiki b/DNE-Coding-Standards.mediawiki index 2eeaf29..0646545 100644 --- a/DNE-Coding-Standards.mediawiki +++ b/DNE-Coding-Standards.mediawiki @@ -107,6 +107,7 @@ Marlin is written in C/C++ and must be able to compile with the supplied Makefil * Use #if ENABLED(FEATURE_NAME) / #endif to compile enabled features. (Using these macros allows features to be set externally.) * Use #if DISABLED(FEATURE_NAME) / #endif to compile disabled features. (Using these macros allows features to be set externally.) * Use #define macros to avoid repeating boilerplate code.
Consider both readability and maintainability. +* Label #endif with the opening #if condition(s) if the block is over ~15 lines. Make the label compact. For example, #endif // SDSUPPORT || ULTRALCD. === Adding a New Feature === Since Marlin is an Arduino firmware and not a desktop application, much care has been taken to keep code size at a minimum, and to avoid using any features that may overtax the hardware, including demanding math operations. New features should try to conserve the limited resources available and allocate a fixed amount of memory (apart from auto variables) to do their work.