c++ - Will including new IDs require recompile? -


globals.h

#define id1 1 #define id2 2 

factory.h

item* makeitem(int id); 

will including new ids in globals.h require recompile of files use makeitem old ids?

also how know changes require recompile or re-linking of dependents?

any change globals.h require recompile of files #include globals.h or include header files include globals.h. if list of ids changes often, , lots of files depend on it, , project big, might become nuisance.

one way around split globals.h different h-files, each h-file used relatively small part of project. then, change in 1 of them not require recompiling.

if this, typically face challenge of keeping of ids unique. if defined in different header files, developer making change in 1 file may not know causing collision id defined in file. 1 solution follow documented convention, in every h-file ids defined has associated range of ids, , ranges not overlapping.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -