Ben Bacarisse wrote:
> Hal Vaughan <hal@[EMAIL PROTECTED]
> writes:
>
>> Philip Potter wrote:
>>
>>> Ben Bacarisse wrote:
>> ...
>>> Indeed. To the OP: how did you manage to state that parseargs() had
two
>>> different declarations? You should *never* type code into a usenet
>>> message - copy-and-paste instead, so that the code you post is exactly
>>> the same as the code you're using.
>>
>> You're right. I knew better, but was a bit fuzzy and probably should
not
>> have been posting at 3:00 am, but it was a case of, "If I can get this
>> one
>> thing done, I can go to bed knowing it's resolved." I'm still out of
it
>> (from lack of sleep) now, so maybe I should just put this on the shelf
>> for a bit and take a break.
>>
>>> From the other message you've posted, I conclude you don't realise
that
>>> the [] in a parameter is significant. The following:
>>>
>>> int main(int argc, char *argv)
>>>
>>> is incorrect, while both of:
>>>
>>> int main(int argc, char *argv[])
>>> int main(int argc, char **argv)
>>>
>>> are correct and completely equivalent..
>>
>> So
>>
>> char *argv[]
>> and
>> char **argv
>>
>> are essentially the same?
>
> Yes, when they are parameters.
>
> The declaration will look like this:
>
> map<string,string> parseargs(int count, char **args);
>
> and the definition will start the same way:
>
> map<string,string> parseargs(int count, char **args)
> { ... }
>
> (Personally, I stick the stars to the name since they modify it -- the
> name -- not the type.)
>
> I think for people new to C and C++ simply using * and never [] (in
> parameter specifications) makes life easier. The trouble is you
> eventually need to know what [] means.
I know what [] means. What surprises me is that I've heard and read so
many
complaints about pointers along the way and how people find them so hard
to
figure out. To me, the hard part is getting used to the syntax and
remembering the difference between * and & and dealing with **. Maybe
it's
because I used to love Assembler so much, but I find pointers a big help
because it lets me make the choice of how to access data if I need to do
it
in different ways, as opposed to Java, which basically insists on making
every decision for me.
Thanks for the extra info!
Hal


|