I
istillshine
When I control if I print messages, I usually use a global variable
"int silent". When I set "-silent" flag in my command line
parameters, I set silent = 1 in my main.c.
I have many functions that may print some messages.
foo(...)
{
if (!silent)
printf("Msg1\n");
}
foo2(...)
{
if (!silent)
printf("Msg2\n");
}
and so on...
Is the above bad coding practice? How to eliminate the variable
"silent" but achieve the same effect?
"int silent". When I set "-silent" flag in my command line
parameters, I set silent = 1 in my main.c.
I have many functions that may print some messages.
foo(...)
{
if (!silent)
printf("Msg1\n");
}
foo2(...)
{
if (!silent)
printf("Msg2\n");
}
and so on...
Is the above bad coding practice? How to eliminate the variable
"silent" but achieve the same effect?