L
Lew Pitcher
In alt.os.linux, I just encountered a post regarding debugging of a C
program (source supplied). I won't trouble the group with the code in
question, but I do have a question of my own about the code.
The programmer had written something like...
typedef enum { false, true } bool;
int TheFunction(argument)
int argument;
{
int inword;
inword = true;
/* other logic followed */
}
Is this use of an enum constant valid? To me, the enum shouldn't
"exist" in that it acts like a "template" courtesy of the typedef. Had
the author included a
bool something;
then the enum would, in my mind, "exist" wrt the code at hand.
What do the C experts here think? Am I wrong to be suspicious of the
OP's typedef and code, or is this really valid C? (Note that both the
original code and my subset example above were coded in K&R C).
program (source supplied). I won't trouble the group with the code in
question, but I do have a question of my own about the code.
The programmer had written something like...
typedef enum { false, true } bool;
int TheFunction(argument)
int argument;
{
int inword;
inword = true;
/* other logic followed */
}
Is this use of an enum constant valid? To me, the enum shouldn't
"exist" in that it acts like a "template" courtesy of the typedef. Had
the author included a
bool something;
then the enum would, in my mind, "exist" wrt the code at hand.
What do the C experts here think? Am I wrong to be suspicious of the
OP's typedef and code, or is this really valid C? (Note that both the
original code and my subset example above were coded in K&R C).