2020/10/01 11:11:29
MOHAEGY
Hello every one 
I have a very large program  may be more than 8000 code line and because many programmers says that you main.c must be less than 1000 line So, i have a big problem here where i have three main blocks of codes in my MAIN.C file and have three header files (file.h), each block include a called functions from header files
*- Now when i want to make a header file and translate one of these big blocks to it this message appear to me "implicit declaration of function '**_**' is invalid in C99" for every called function from header files  with many errors due to every big block of code have a called function from one of header files
WHAT is the best way to minimize the MAIN.C file and transfer blocks to another file where i can just call the block in the main file 
thanks 
2020/10/01 11:22:14
1and0
Robotics011
... have three header files (file.h), each block include a called functions from header files
*- Now when i want to make a header file and translate one of these big blocks to it this message appear to me "implicit declaration of function '**_**' is invalid in C99" for every called function from header files  with many errors due to every big block of code have a called function from one of header files

Code in header files should NOT call functions.
2020/10/01 11:24:47
NKurzman
First you have the Option to tell the compiler to use C90 ode.
implicit declaration of function means you do not have Prototypes for your functions.
You should have a Prototype before the function is used.
 
"call the block"  I assume your Blocks are functions.
2020/10/01 13:22:42
ric
Robotics011
WHAT is the best way to minimize the MAIN.C file and transfer blocks to another file where i can just call the block in the main file 

I guess you have never worked with a project containing multiple C files.
Header files should NOT contain executable code.
Have a read of:
Organizing Code Files in C and C++ (Ignore the C++ specific bits)
 
2020/10/01 14:35:27
MOHAEGY
Dear/ RIC actually yes  i will read : Organizing Code Files in C and C++  
WHEN i convert to C90 i open the door of hill there are many warning: (373) implicit signed to unsigned conversion and (359) illegal conversion between pointer types
" "call the block"  I assume your Blocks are functions." ===> every block of the main three blocks contains call functions, and executable codes using "if , while ,and others 
2020/10/01 14:44:10
jtemples
At a minimum, you should be concerned about the "illegal conversion between pointer types" warnings.
2020/10/01 15:00:37
MOHAEGY
Now after i read the article Organizing Code Files in C and C++  i discovered that we split C file to many files just for easymodify and maintenance just for things like that not for performance 
So, if my MAIN.C have a 10000 line no problem and not affect the performance of my project 
am i right?
 
2020/10/01 15:25:12
Antipodean
splitting your code up does several things: -
It modularises your code so you can isolate sections. I.e. have separate files for things like UART, SPI, I2C for example. This also allows you to have private variables in each module, which can also reduce unwanted interactions between parts of your code.
By separating the code out into separate files only the file you are currently changing needs to be compiled before it gets linked with the other files, giving faster compile times, especially if the compiler can use multiple threads if you change several files. If everything is in one large file then the whole file has to be compiled each time.
With separate files error messages can include the file name so you know which module to look in to find the problem, rather than paging through a horrendously large file. 
 
2020/10/01 16:30:24
ric
Someone has quoted Anti-podean's post without paying attention to the big warning in his signature.
 
2020/10/01 16:48:36
jtemples
So, if my MAIN.C have a 10000 line no problem and not affect the performance of my project am i right?

 
The number of lines of code in a C file has nothing to do with performance.
12
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account