Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Function terminology QUESTION

Reply
Thread Tools

Re: Function terminology QUESTION

 
 
Les Cargill
Guest
Posts: n/a
 
      10-13-2013
rashan wrote:
> Hello,
>
> Do you say there is a difference between " parameter " and " argument "
> in as what is passed to C functions?
>
> Would one be for functions and another for sub/method or so? Or ByRef/
> ByVal?
>
> Regards,
>


No. Those are absolute synonyms. A "method" is just a function where
you don't care about the return value.

--
Les Cargill

 
Reply With Quote
 
 
 
 
Tiib
Guest
Posts: n/a
 
      10-13-2013
On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:
> rashan wrote:
> > Do you say there is a difference between " parameter " and " argument "
> > in as what is passed to C functions?


That is same in all programming languages. Parameter is internal for
subroutine or procedure. Same with functions of C. Argument is the same
thing from perspective of caller of that function. Caller fills parameters
with arguments.

> > Would one be for functions and another for sub/method or so? Or ByRef/
> > ByVal?

>
> No. Those are absolute synonyms. A "method" is just a function where
> you don't care about the return value.


Not sure what you mean. Return value is simply special "out" parameter
present in many programming languages that may be missing or present
in subroutines. That does not make something a "method".

A "method" is OOP term. It means a subroutine or procedure that is
associated with object. Associated object is passed to subroutine as
"in-out" parameter. In OOP languages the associated object is
indicated differently from other arguments outside of call
('object.method(42)') and represented specially from other
parameters ('this' or 'self') inside of subroutine.

C does not have support for such thing so someone doing OOP using C
simply uses first parameter of function as "pointer to associated
object of method". On most cases it is good and clear enough and no
special syntax sugar is needed.

 
Reply With Quote
 
 
 
 
glen herrmannsfeldt
Guest
Posts: n/a
 
      10-13-2013
Tiib <(E-Mail Removed)> wrote:
> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:
>> rashan wrote:
>> > Do you say there is a difference between " parameter " and " argument "
>> > in as what is passed to C functions?


> That is same in all programming languages. Parameter is internal for
> subroutine or procedure. Same with functions of C. Argument is the
> same thing from perspective of caller of that function.
> Caller fills parameters with arguments.


In Fortran they are actual argument and dummy argument. I always have
to remember which language is being discussed before writing.

(snip)
>> No. Those are absolute synonyms. A "method" is just a function where
>> you don't care about the return value.


(snip)

> A "method" is OOP term. It means a subroutine or procedure that is
> associated with object. Associated object is passed to subroutine as
> "in-out" parameter. In OOP languages the associated object is
> indicated differently from other arguments outside of call
> ('object.method(42)') and represented specially from other
> parameters ('this' or 'self') inside of subroutine.


Java also has static methods which don't have a this object.
They are still methods, not functions.

-- glen

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-13-2013
Les Cargill <(E-Mail Removed)> writes:
> rashan wrote:
>> Do you say there is a difference between " parameter " and " argument "
>> in as what is passed to C functions?
>>
>> Would one be for functions and another for sub/method or so? Or ByRef/
>> ByVal?

>
> No. Those are absolute synonyms. A "method" is just a function where
> you don't care about the return value.


I've never seen the word "method" used that way. The C standard
never uses the word "method" in that sense.

In C++ and other OO languages, "method" is often used to refer to
a function (or procedure, or subroutine, or ...) that's associated
with a class. It typically has nothing to do with the return value.
The C++ standard, as I recall, doesn't use the term "method", but
refers to them as "member functions". C doesn't have "methods"
in that sensse.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Les Cargill
Guest
Posts: n/a
 
      10-14-2013
Tiib wrote:
> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:
>> rashan wrote:
>>> Do you say there is a difference between " parameter " and " argument "
>>> in as what is passed to C functions?

>
> That is same in all programming languages. Parameter is internal for
> subroutine or procedure. Same with functions of C. Argument is the same
> thing from perspective of caller of that function. Caller fills parameters
> with arguments.
>
>>> Would one be for functions and another for sub/method or so? Or ByRef/
>>> ByVal?

>>
>> No. Those are absolute synonyms. A "method" is just a function where
>> you don't care about the return value.

>
> Not sure what you mean. Return value is simply special "out" parameter
> present in many programming languages that may be missing or present
> in subroutines. That does not make something a "method".
>


I put it in quotes for a reason - Pascal for example has "procdures"
and "functions" which follow the distinction I laid out.

> A "method" is OOP term. It means a subroutine or procedure that is
> associated with object. Associated object is passed to subroutine as
> "in-out" parameter. In OOP languages the associated object is
> indicated differently from other arguments outside of call
> ('object.method(42)') and represented specially from other
> parameters ('this' or 'self') inside of subroutine.
>


Still...


> C does not have support for such thing so someone doing OOP using C
> simply uses first parameter of function as "pointer to associated
> object of method". On most cases it is good and clear enough and no
> special syntax sugar is needed.
>


--
Les Cargill
 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      10-14-2013
On 10/13/2013 10:13 PM, Les Cargill wrote:
> �� Tiib wrote:
>> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:

....
>>> No. Those are absolute synonyms. A "method" is just a function where
>>> you don't care about the return value.

>>
>> Not sure what you mean. Return value is simply special "out" parameter
>> present in many programming languages that may be missing or present
>> in subroutines. That does not make something a "method".
>>

>
> I put it in quotes for a reason - Pascal for example has "procdures"
> and "functions" which follow the distinction I laid out.


Yes, I'm also familiar with other languages that make the same
distinction - between functions and procedures. Can you cite a context
where that same distinction is made using the term "method" rather than
"procedure"?
--
James Kuyper
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-14-2013
Les Cargill <(E-Mail Removed)> writes:
> Öö Tiib wrote:
>> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:
>>> rashan wrote:

[...]
>>>> Would one be for functions and another for sub/method or so? Or ByRef/
>>>> ByVal?
>>>
>>> No. Those are absolute synonyms. A "method" is just a function where
>>> you don't care about the return value.

>>
>> Not sure what you mean. Return value is simply special "out" parameter
>> present in many programming languages that may be missing or present
>> in subroutines. That does not make something a "method".

>
> I put it in quotes for a reason - Pascal for example has "procdures"
> and "functions" which follow the distinction I laid out.


Yes, it does. (More precisely, Pascal procedures don't have
return values at all.)

But I don't understand what you mean when you say that you "put it
in quotes for a reason". What is that reason?

Bottom line: that's not what the word "method" means.

I suggest that you've simply made a mistake. Trying to justify it
is not helpful. (Unless you can support your claim that "method"
is used to mean "a function where you don't care about the return
value", which would surprise me.)

[...]

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-14-2013
Öö Tiib <(E-Mail Removed)> writes:
> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:
>> rashan wrote:
>> > Do you say there is a difference between " parameter " and " argument "
>> > in as what is passed to C functions?

>
> That is same in all programming languages. Parameter is internal for
> subroutine or procedure. Same with functions of C. Argument is the same
> thing from perspective of caller of that function. Caller fills parameters
> with arguments.


Most programming languages do make that distinction. Not all of them
use the words "parameter" and "argument" to make that distinction.
Ada, for example, uses the terms "formal parameter" and "actual
parameter".

[...]

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Les Cargill
Guest
Posts: n/a
 
      10-14-2013
James Kuyper wrote:
> On 10/13/2013 10:13 PM, Les Cargill wrote:
>> �� Tiib wrote:
>>> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:

> ...
>>>> No. Those are absolute synonyms. A "method" is just a function where
>>>> you don't care about the return value.
>>>
>>> Not sure what you mean. Return value is simply special "out" parameter
>>> present in many programming languages that may be missing or present
>>> in subroutines. That does not make something a "method".
>>>

>>
>> I put it in quotes for a reason - Pascal for example has "procdures"
>> and "functions" which follow the distinction I laid out.

>
> Yes, I'm also familiar with other languages that make the same
> distinction - between functions and procedures. Can you cite a context
> where that same distinction is made using the term "method" rather than
> "procedure"?
>


I beleive "method" is C++ (or perhaps other OO language)
specific.

It was the OP's term....

--
Les Cargill
 
Reply With Quote
 
Les Cargill
Guest
Posts: n/a
 
      10-14-2013
Keith Thompson wrote:
> Les Cargill <(E-Mail Removed)> writes:
>> Öö Tiib wrote:
>>> On Sunday, 13 October 2013 21:17:51 UTC+3, Les Cargill wrote:
>>>> rashan wrote:

> [...]
>>>>> Would one be for functions and another for sub/method or so? Or ByRef/
>>>>> ByVal?
>>>>
>>>> No. Those are absolute synonyms. A "method" is just a function where
>>>> you don't care about the return value.
>>>
>>> Not sure what you mean. Return value is simply special "out" parameter
>>> present in many programming languages that may be missing or present
>>> in subroutines. That does not make something a "method".

>>
>> I put it in quotes for a reason - Pascal for example has "procdures"
>> and "functions" which follow the distinction I laid out.

>
> Yes, it does. (More precisely, Pascal procedures don't have
> return values at all.)
>
> But I don't understand what you mean when you say that you "put it
> in quotes for a reason". What is that reason?
>


Really???

http://en.wikipedia.org/wiki/Scare_quotes

> Bottom line: that's not what the word "method" means.
>
> I suggest that you've simply made a mistake. Trying to justify it
> is not helpful. (Unless you can support your claim that "method"
> is used to mean "a function where you don't care about the return
> value", which would surprise me.)
>
> [...]
>


I was gently trying to steer the OP towards that distinction.

--
Les Cargill
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Function terminology QUESTION August Karlstrom C Programming 1 10-13-2013 10:30 PM
Re: Function terminology QUESTION James Kuyper C Programming 0 10-13-2013 01:52 PM
Re: Function terminology QUESTION Eric Sosman C Programming 0 10-13-2013 12:34 PM
Re: well-defined terminology versus generally accepted terminology regarding pointers and arrays Paul C++ 63 04-24-2011 12:42 PM
terminology question - "foreign function library" mirandacascade@yahoo.com Python 2 12-24-2006 09:27 PM



Advertisments