@dtvdeveloper said:
// passing a param for the fun of it...?
static void com_HttpConnecting(int cond)
{
_state.modemState = MODEM_STATE_CONNECTING;
}
If this is part of a class,. then no, because a child method may
override this, and need the parameter. In fact it looks
like this is the case.
You implied C, which doesn't have classes, but if that is the case look for a function like this:
static void net_HttpConnection(int cont)
{
if (cond == foo) bar();
else baz();
}
The int parameter is needed because if you use a function pointer to
switch between modem and network code, you need to have the unused
parameter so the pointers work right.
Often too I have refactored a function to not need a parameter, but
decided the effort to remove the unused parameter is not worth the
bother, which would again leave something like this.
Note that if this is C, variables that begin with an _ are often
reserved (the rules are a little tricky, I can't remember them exactly).
Its C (not C++), so no objects or overloading. Interesting your point about using a pointer to the function, I did not think it would care that the parameters would need to be the same as the function is itself a pointer.....(so in essence it would be just a pointer to a pointer wouldnt it?)
C vars with _ prefixes being reserved is definitely not in this case. i take it that must be a platform specific rule? (i have never heard that or read it in any book).