From 8595bc7122c9e0cb34b558446cb959ec3e30cc81 Mon Sep 17 00:00:00 2001 From: Jonathan Brown Date: Sat, 3 Jun 2017 14:12:33 +0700 Subject: for free => automatically Getters still use gas when called from another contract, so they are not free. --- docs/miscellaneous.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 914dfacd..2e0ccf45 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -371,7 +371,7 @@ Tips and Tricks * Use ``delete`` on arrays to delete all its elements. * Use shorter types for struct elements and sort them such that short types are grouped together. This can lower the gas costs as multiple SSTORE operations might be combined into a single (SSTORE costs 5000 or 20000 gas, so this is what you want to optimise). Use the gas price estimator (with optimiser enabled) to check! -* Make your state variables public - the compiler will create :ref:`getters ` for you for free. +* Make your state variables public - the compiler will create :ref:`getters ` for you automatically. * If you end up checking conditions on input or state a lot at the beginning of your functions, try using :ref:`modifiers`. * If your contract has a function called ``send`` but you want to use the built-in send-function, use ``address(contractVariable).send(amount)``. * Initialise storage structs with a single assignment: ``x = MyStruct({a: 1, b: 2});`` -- cgit v1.2.3