Just as long as your function parameter types are not that identical. ;)

05-13-2002

Koedoe

"This is illegal so the compiler won't allow it. "

I know that - but why is it illegal?

Thanx for the reply though.

05-13-2002

SilentStrike

Because the compiler can't determine which one to call based on the return type, doing so would be extremely error prone when it isn't absolutely impossible.

So either change the function name or the functions parameters.

05-13-2002

Magos

Re: "This is illegal so the compiler won't allow it. "

Quote:

Originally posted by Koedoe I know that - but why is it illegal?

Thanx for the reply though.

Because when you run the function Message(void) the compiler has two functions to choose from, and he doesn't know which one to take. This is illegal and illogical.
If the functions have different argument lists, then it knows which one to pick.

05-13-2002

Koedoe

I know that the compiler mangles the function names using the argument lists - why doesn't it just include the return type in the mangled name?

05-13-2002

Magos

Quote:

Originally posted by Koedoe I know that the compiler mangles the function names using the argument lists - why doesn't it just include the return type in the mangled name?

Because C isn't strictly typed as compared to Ada :D. You can return a char but store it in an integer variable.