#define _CRT_RAND_S
#include <stdlib.h> // for rand_s
This and some other defines must be declared before certain includes. Is there a way around this, in case a previously included header had already included stdlib.h.
I understand that, however my worry is;
Even if it is the first #include, as this is a common code I'm likely to use in a lot of projects, I would have to make sure to include the common code before including <stdlib.h>. Which I'm probable to not remember, especially if I'm not looking at the code.
Example:
common_code.h
1 2
#define _CRT_RAND_S
#include <stdlib.h> // for rand_s
project_code.h
1 2
#include <stdlib.h> // for EXIT_SUCCESS
#include "common_code.h"
I was thinking I could possibly #undef something in particular before defining _CRT_RAND_S.