Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #71834

Re: Do function arguments invoke a function?

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c, comp.lang.java.programmer
Subject Re: Do function arguments invoke a function?
Date 2015-10-04 14:36 -0400
Organization Self
Message-ID <561171C7.5060700@verizon.net> (permalink)
References <eaba057c-8bec-449a-8055-039f2c314655@googlegroups.com> <56115B07.6070102@verizon.net> <invocation-20151004180729@ram.dialup.fu-berlin.de>

Cross-posted to 2 groups.

Show all headers | View raw


On 10/04/2015 01:19 PM, Stefan Ram wrote:
> Newsgroups: comp.lang.c,comp.lang.java.programmer
> 
> James Kuyper <jameskuyper@verizon.net> writes:
>> On 10/04/2015 05:15 AM, Chad wrote:
> 
>>> In Java, when a method is called, the methods arguments invoke the method.
>      ^^^^ thus the Newsgroups header!
> 
>> Could you explain what that phrase "the method's arguments invoke the
>> method" means to you? Knowing that, I might be able to answer with
>> respect to C. As it stands, the phrase doesn't make sense to me.
> 
>   You are right!
> 
>   To »invoke« means to start, to execute, to run something. Arguments are
>   expressions that can be part of a method invocation expression.

OK - it's just as true in C/C++ that the argument of a function can be
the result of evaluating an expression. I hadn't thought of his question
in those terms. In that sense, in C++ an argument expression can invoke
methods associated with the objects involved in the expression, and can
invoke methods associated with the same class that the calling method is
associated with, even including another instance of the same method.
However, they cannot be said, in any sense, to invoke the same instance
of that method which they themselves are arguments of. It's the calling
code that does that invocation, not the arguments.

Evaluation of all method arguments must be complete, before evaluation
of the method itself can start, so it's never the case that the
arguments themselves invoke the instance of the method that they
themselves are arguments to. Does Java have different rules in this
regard that would make Chad's comment meaningful?

>  For example, in Java, the following is an expression:
> 
> java.lang.Math.random()
> 
>   . This method invocation expression (JLS 15.12) has no arguments.
>   If the method's arguments would invoke the method, it would not
>   be invoked here, since there are no arguments.
> 
>   Moreover, a method does not have arguments in Java at all. It has
>   /parameters/. A /method invocation expression/ has arguments.

That distinction applies to C/C++ as well.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Do function arguments invoke a function? Chad <cdalten@gmail.com> - 2015-10-04 02:15 -0700
  Re: Do function arguments invoke a function? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-04 08:09 -0400
    Re: Do function arguments invoke a function? Chad <cdalten@gmail.com> - 2015-10-04 13:52 -0700
      Re: Do function arguments invoke a function? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-04 17:13 -0400
      Re: Do function arguments invoke a function? James Kuyper <jameskuyper@verizon.net> - 2015-10-04 17:13 -0400
      Re: Do function arguments invoke a function? Geoff <geoff@invalid.invalid> - 2015-10-04 17:09 -0700
      Re: Do function arguments invoke a function? Geoff <geoff@invalid.invalid> - 2015-10-04 17:10 -0700
        Re: Do function arguments invoke a function? Chad <cdalten@gmail.com> - 2015-10-04 19:50 -0700
          Re: Do function arguments invoke a function? James Kuyper <jameskuyper@verizon.net> - 2015-10-05 00:26 -0400
  Re: Do function arguments invoke a function? James Kuyper <jameskuyper@verizon.net> - 2015-10-04 12:59 -0400
    Re: Do function arguments invoke a function? James Kuyper <jameskuyper@verizon.net> - 2015-10-04 14:36 -0400
  Re: Do function arguments invoke a function? jacobnavia <jacob@jacob.remcomp.fr> - 2015-10-04 19:26 +0200
  Re: Do function arguments invoke a function? Keith Thompson <kst-u@mib.org> - 2015-10-04 15:36 -0700
  Re: Do function arguments invoke a function? Rosario19 <Ros@invalid.invalid> - 2015-10-05 05:49 +0200

csiph-web