c - Is it a good practice to include all files in one .h file and include that file everywhere for AVR? -


क्या मैं ऐसा कर सकता हूँ

  / * include all.h * / #ifndef INCLUDEALL_H_ # परिभाषित INLUDEALL_H_ 1 # शामिल करें & lt; avr / io.h & gt; # शामिल करें & lt; avr / pgmspace.h & gt; # शामिल करें & lt; avr / interrupt.h & gt; #include "DataTypeDefs.h" # शामिल "timer_api.h" #include "uart_api.h" #include "RTC_PCF8563.h" #include "TWI_Master.h" # # "ADC_LTC1859.h" # शामिल करें "spi.h" # शामिल करें शामिल करें "AT45DB161D_UART_AS_mSPI.h" #include "utilities.h" #ifndef F_CPU #define F_CPU 16000000UL #endif #include & lt; util / delay.h & gt; #include & lt; string.h & gt; #endif / * INCLUDEALL_H_ * /   

और इसमें शामिल हैं all.h फ़ाइल हर जगह। हर जगह सभी प्रोजेक्ट फाइलों में इसका अर्थ है।

अन्य सभी फाइलों में #define INCLUDEALL_H_ 1 की तरह ही मैक्रो का उपयोग किया गया है।

मुझे लगता है कि संकलन समय में बहुत समय लगता है। < संकलित समय जुर्माना के अलावा, ऐसा करने से कोड का बदलना / पोर्टिंग / रिफ़ैक्टरिंग बहुत कठिन होता है।

मेरे पास सामान्य नियम है कि मैं निरपेक्ष न्यूनतम पर निर्भरता रखता हूं यह सही जगह पर एक लापता हेडर शामिल करने के लिए ज्यादा काम नहीं करता है, और बाद में आपको बहुत अधिक सिरदर्द बचाता है।

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -