mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Explain the limitations of view and pure
This commit is contained in:
		
							parent
							
								
									f791ca3957
								
							
						
					
					
						commit
						2af949baaa
					
				| @ -469,6 +469,17 @@ View Functions | ||||
| 
 | ||||
| Functions can be declared ``view`` in which case they promise not to modify the state. | ||||
| 
 | ||||
| The following statements are considered modifying the state: | ||||
| 
 | ||||
| #. Writing to state variables. | ||||
| #. :ref:`Emitting events. <events>`. | ||||
| #. :ref:`Creating other contracts <creating-contracts>`. | ||||
| #. Using ``selfdestruct``. | ||||
| #. Sending Ether via calls. | ||||
| #. Calling any function not marked ``view`` or ``pure``. | ||||
| #. Using low-level calls. | ||||
| #. Using inline assembly that contains certain opcodes. | ||||
| 
 | ||||
| :: | ||||
| 
 | ||||
|     pragma solidity ^0.4.16; | ||||
| @ -496,6 +507,13 @@ Pure Functions | ||||
| 
 | ||||
| Functions can be declared ``pure`` in which case they promise not to read from or modify the state. | ||||
| 
 | ||||
| In addition to the list of state modifying statements explained above, the following are considered reading from the state: | ||||
| #. Reading from state variables. | ||||
| #. Accessing ``this.balance`` or ``<address>.balance``. | ||||
| #. Accessing any of the members of ``block``, ``tx``, ``msg`` (with the exception of ``msg.sig`` and ``msg.data``). | ||||
| #. Calling any function not marked ``pure``. | ||||
| #. Using inline assembly that contains certain opcodes. | ||||
| 
 | ||||
| :: | ||||
| 
 | ||||
|     pragma solidity ^0.4.16; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user