tags:

views:

109

answers:

3

I have a function:

int get_symbol(tab *tp, FILE *fp, char delim)

and I call it like this:

get_symbol(tp, fp, ';')

I always have it declared in the header as:

int get_symbol(tab *, FILE *, char);

No this all works fine, I can execute the code in the function and the delim is set. But if I try to add one more char to the function's signature like:

int get_symbol(tab *tp, FILE *fp, char delim1, char delim2)

The function stops executing. Why would that be?

+1  A: 

You should have :

int get_symbol(tab *tp, FILE *fp, char delim1, char delim2)
{
blah blah;
return 1;
}
...
...

get_symbol(tp, fp, ';','?')

do You?

bua
A: 

As a guess at what "stops executing" could mean, did you update the signature in the header file as well?

Jim Buck
yes, of course....
goe
What does "stops executing" mean then? You will need to post the code for the function and describe what you expect to happen.
Jim Buck
+1  A: 

OK, there's not enough information here, so I'm going to make a wild stab at an answer.

You're using a C++ compiler, and don't have warning levels set very high. You've changed the prototype for the function, but you've not changed the arguments when you call it. The C++ compiler is treating these as different functions due to overloading, and so is not calling the right one.

This may be way off what's happening. If it is, give us something more to go on….

Tim