Hal Vaughan <hal@[EMAIL PROTECTED]
> writes:
> Ben Bacarisse wrote:
>
>> Hal Vaughan <hal@[EMAIL PROTECTED]
> writes:
>>
>>> Hal Vaughan wrote:
>>>
>>>> Hal Vaughan wrote:
>>> ...
>>>> There's one problem that didn't show up until I fixed this one.
>>>>
>>>> I have my own library with this function:
>>>>
>>>> void parseargs(int, char*);
>>
>> This declaration does not match the definition you give later.
>
> Okay. I'm a bit confused. I have:
>
> int main(int argc, char* argv[])
>
> which leads me to believe argv is of type char*,
Ah, no. In C and C++, the [] in a parameter list act almost exactly
like a *. argv is and array of char pointers and thus becomes a
pointer to a the first char pointer when it is passed to main. The []
form is transitional but a little confusing.
> so when I call
>
> parseargs(argc, argv)
>
> I would expect parseargs to have the same signature as far as the params
go:
>
> map<string,string> parseargs(int count, char* args[])
That is correct.
> From what you say, it should be:
>
> map<string,string> parseargs(int count, char** args[])
No. Your problem is in the declaration. You showed a line:
void parseargs(int argc, char *argv);
which is quite different.
--
Ben.


|