Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > C++ side effect...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 9473 of 10094
Post > Topic >>

C++ side effects

by baibaichen <baibaichen@[EMAIL PROTECTED] > Apr 8, 2008 at 08:19 AM

hi All

the following comes from c++ standards:

"Accessing an object designated by a volatile lvalue (3.10), modifying
an object, calling a library I/O
function, or calling a function that does any of those operations are
all side effects, which are changes in the
state of the execution environment."

According to this definition, consider this function,

T ReturnT(){
    T result_;
    //do something
   return result_;    // #1
}

At #1, I think
1) if T is scalre type such as int or char, the returning sentence
would not have side effects
2) if T is a class type,  does returning type T have side effects? and
Why?

Thanks
Chang

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 5 Posts in Topic:
C++ side effects
baibaichen <baibaichen  2008-04-08 08:19:10 
Re: C++ side effects
"Bo Persson" &l  2008-04-08 13:36:14 
Re: C++ side effects
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-08 16:53:23 
Re: C++ side effects
"Bo Persson" &l  2008-04-09 13:20:16 
Re: C++ side effects
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-09 13:43:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 3:59:01 CDT 2008.