Using an enum as a parameter and a return type in a function in C -


if decided use enum, such one:

typedef enum {     false, true = !false } bool; 

as parameter, , return type in function:

bool foo(bool param) {     <do something>     return true; } 

would cause problems? example, across compilers.

ps: don't intend use #include <stdbool.h>

since don't intend #include <stdbool.h> (which might cause conflicts), there should not problem approach.


however, if big project, others contribute too, wouldn't recommend go on approach, because might include header. moreover, if decide use code in future project of yours, pretty sure not remember detail prevention of including header, except if document nicely.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -