-
Bad Practice??
Hi
Below is the start of a small piece of code with just two includes.
Time is to seed the random number and conio.c is for every thing
else.Is it right to just use conio.c as this includes stdio.h ,conio.h or by including conio.c am I making the
compiler do more work than it should ???
-
opps forgot the code snippet
#include <time.h>
#include <conio.c>
int main (void)
{
int counter = 0;
int x;
srand( (unsigned)time( NULL ) );
-
> am I making the compiler do more work than it should ???
Probably - you should not include .c files, but instead add them to the project or makefile.
Whatever includes conio.c has shouldn't matter (nor should you care), and you certainly shouldn't depend on it including specific things.
In your main.c, if you need
#include <stdio.h>
#include <time.h>
#include <conio.h>
Then you should do so, and you are free to remove them if you no longer require that .h file (to compile the current file).