On Fri, Sep 19, 2014 at 5:56 PM, Keith Medcalf <kmedc...@dessus.com> wrote:

>
> >While you are correct that the action is "nonsensical" based on the
> >definition of the API, surely you can concede that in an environment (C
> >programming) where "argv" is an intrinsic part of every program thanks to
> >that name's standard use as a parameter to main
>
> But that is because you (meaning the person who wrote the main function)
> have declared the symbolic names for the arguments to the function "main"
> to be those names.  The names themselves are meaningless.  Are you
> suggesting that if you ran a global search and replace of the web and all
> printed materials that replaced:
>
> int main(int argc, char *argv[]) -> int main(int urinals, char
> *urinalcake[])
>
> that unrinals and urinalcake's would thereby get magic status, and that
> people would start calling "arguments to functions" "urinalcakes" instead
> of arguments?  Does that mean that every usage of the word "urinals" refers
> to the count of the argument strings to the function main?
>

I know this. You know this. I know it can be named any valid identifier. Of
course I'm not suggesting that. I'm saying that the inexperienced
programmer might not understand that and that a kind response vs a
belittling response is probably not such a bad course of action to take.
When one is accustomed to seeing "argv" all the time in only a single
context, I think it is understandable that they might jump to the
(incorrect in this case) conclusion that argv is a char**.


> There is no magic associated with a symbol name in C -- it is simply what
> you chose to call it.  Just because you chose to call something "argc" does
> not mean that it is a count of anything (much less a count of arguments),
> nor even that it is a default width integer; nor does calling something an
> argv make it an array of pointers to character strings.
>

There is something "magic" about main in standard C / C++ hosted
environments (because it is what the standard library wants to jump to
after running the library startup code). I dare say most developers have
not read the standards documents and thus don't know or understand the
exact difference between "hosted" and "free standing" environments or why
main is used "everywhere" except (practically) for Windows GUI apps which
need a WinMain instead of main.


> >, and where it is understood to be defined as "char**" or equivalent,
> >one might be forgiven for not quite understanding the difference.
>
> No THE PERSON TYPING THE CODE declared it as a char**.  (Of course, the
> actual type of the argument strings passed to the main function of a C
> program is char*[], not char**, so you are technically using an incorrect
> declaration and have made an incorrect assumption about the meaning of argv
> anyway).
>

Please carefully re-read my comment: 'defined as "char**" or equivalent'.
"char** argv" is the same as "char* argv[]" in every way except for
spelling.

Anyway, sorry for opening such a can of worms. You'll note I haven't made
these types of comments with regard to people asking questions that seem
obviously to be for homework problems or for deep explanations of the
innards of exactly how VDBE works. In this case I didn't think the question
asked warranted the type of response I read. No more or less. Take care.

-- 
Scott Robison


On Fri, Sep 19, 2014 at 5:56 PM, Keith Medcalf <kmedc...@dessus.com> wrote:

>
> >While you are correct that the action is "nonsensical" based on the
> >definition of the API, surely you can concede that in an environment (C
> >programming) where "argv" is an intrinsic part of every program thanks to
> >that name's standard use as a parameter to main
>
> But that is because you (meaning the person who wrote the main function)
> have declared the symbolic names for the arguments to the function "main"
> to be those names.  The names themselves are meaningless.  Are you
> suggesting that if you ran a global search and replace of the web and all
> printed materials that replaced:
>
> int main(int argc, char *argv[]) -> int main(int urinals, char
> *urinalcake[])
>
> that unrinals and urinalcake's would thereby get magic status, and that
> people would start calling "arguments to functions" "urinalcakes" instead
> of arguments?  Does that mean that every usage of the word "urinals" refers
> to the count of the argument strings to the function main?
>
> There is no magic associated with a symbol name in C -- it is simply what
> you chose to call it.  Just because you chose to call something "argc" does
> not mean that it is a count of anything (much less a count of arguments),
> nor even that it is a default width integer; nor does calling something an
> argv make it an array of pointers to character strings.
>
> >, and where it is understood to be defined as "char**" or equivalent,
> >one might be forgiven for not quite understanding the difference.
>
> No THE PERSON TYPING THE CODE declared it as a char**.  (Of course, the
> actual type of the argument strings passed to the main function of a C
> program is char*[], not char**, so you are technically using an incorrect
> declaration and have made an incorrect assumption about the meaning of argv
> anyway).
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Scott Robison
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to