Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > behaviour of a function

Reply
Thread Tools

behaviour of a function

 
 
subramanian100in@yahoo.com, India
Guest
Posts: n/a
 
      09-20-2007
Kindly explain what is meant by behaviour of a function ? Does it mean
what task the function performs - say for example finding the square
root of a function Or does it mean how a function performs the task,
that is, the way of accomplishing a task

Kindly give the body of a function explaining what is meant by
behaviour of a function.

Thanks
V.Subramanian

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      09-20-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Kindly explain what is meant by behaviour of a function ? Does it mean
> what task the function performs - say for example finding the square
> root of a function Or does it mean how a function performs the task,
> that is, the way of accomplishing a task
>
> Kindly give the body of a function explaining what is meant by
> behaviour of a function.


Read about "return values" and "side effects". If the function does
not have any of those, it has no behaviour.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
 
subramanian100in@yahoo.com, India
Guest
Posts: n/a
 
      09-21-2007
On Sep 20, 8:44 am, "Victor Bazarov" <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > Kindly explain what is meant by behaviour of a function ? Does it mean
> > what task the function performs - say for example finding the square
> > root of a function Or does it mean how a function performs the task,
> > that is, the way of accomplishing a task

>
> > Kindly give the body of a function explaining what is meant by
> > behaviour of a function.

>
> Read about "return values" and "side effects". If the function does
> not have any of those, it has no behaviour.
>
> V
> --
> Please remove capital 'A's when replying by e-mail
> I do not respond to top-posted replies, please don't ask


May I request you to give example function bodies for these for me to
understand the behaviour.

Please excuse me if I am wrong in asking it.

Thanks
V.Subramanian

 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      09-21-2007
(E-Mail Removed), India wrote:

> On Sep 20, 8:44 am, "Victor Bazarov" <(E-Mail Removed)> wrote:
>> (E-Mail Removed) wrote:
>> > Kindly explain what is meant by behaviour of a function ? Does it mean
>> > what task the function performs - say for example finding the square
>> > root of a function Or does it mean how a function performs the task,
>> > that is, the way of accomplishing a task

>>
>> > Kindly give the body of a function explaining what is meant by
>> > behaviour of a function.

>>
>> Read about "return values" and "side effects". If the function does
>> not have any of those, it has no behaviour.
>>
>> V
>> --
>> Please remove capital 'A's when replying by e-mail
>> I do not respond to top-posted replies, please don't ask

>
> May I request you to give example function bodies for these for me to
> understand the behaviour.

[snip]

This is a function with a return value:

int four ( void ) {
return ( 4 );
}

This is a function with a side effect:

void make_four ( int & i ) {
i = 4;
}

This is a function with a side effect that you cannot tell from the
signature:

void log_error_4 ( void ) {
std::cerr << "Encountered Error 4. Don't ask what that means.\n";
}


Best

Kai-Uwe Bux

 
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
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
pre, post increment standard behaviour, and friend function declaration eddiew_AUS C++ 18 01-27-2004 04:31 PM
Calling cgi from cgi thru 'system' function. Different behaviour on browser v/s cmd line Shailan Perl 2 12-15-2003 04:26 PM
strange function behaviour muser C++ 9 10-14-2003 09:50 AM



Advertisments