mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Corrected capitalisation of symbol names
This commit is contained in:
parent
a8164eb5d7
commit
c851cd0481
@ -185,7 +185,7 @@ return parameter list for functions.
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
function f(uint a) private returns (uint b) { return a + 1; }
|
function f(uint a) private returns (uint b) { return a + 1; }
|
||||||
function setData(uint a) internal { data = a; }
|
function setData(uint a) internal { data = a; }
|
||||||
uint public data;
|
uint public data;
|
||||||
@ -214,7 +214,7 @@ it is a state variable and if it is accessed externally
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
contract test {
|
contract Test {
|
||||||
uint public data = 42;
|
uint public data = 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ The next example is a bit more complex:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
contract complex {
|
contract Complex {
|
||||||
struct Data {
|
struct Data {
|
||||||
uint a;
|
uint a;
|
||||||
bytes3 b;
|
bytes3 b;
|
||||||
@ -266,7 +266,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
|||||||
// This means that if the owner calls this function, the
|
// This means that if the owner calls this function, the
|
||||||
// function is executed and otherwise, an exception is
|
// function is executed and otherwise, an exception is
|
||||||
// thrown.
|
// thrown.
|
||||||
modifier onlyowner {
|
modifier onlyOwner {
|
||||||
if (msg.sender != owner)
|
if (msg.sender != owner)
|
||||||
throw;
|
throw;
|
||||||
_
|
_
|
||||||
@ -275,11 +275,11 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
|||||||
|
|
||||||
|
|
||||||
contract mortal is owned {
|
contract mortal is owned {
|
||||||
// This contract inherits the "onlyowner"-modifier from
|
// This contract inherits the "onlyOwner"-modifier from
|
||||||
// "owned" and applies it to the "close"-function, which
|
// "owned" and applies it to the "close"-function, which
|
||||||
// causes that calls to "close" only have an effect if
|
// causes that calls to "close" only have an effect if
|
||||||
// they are made by the stored owner.
|
// they are made by the stored owner.
|
||||||
function close() onlyowner {
|
function close() onlyOwner {
|
||||||
selfdestruct(owner);
|
selfdestruct(owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
|||||||
registeredAddresses[msg.sender] = true;
|
registeredAddresses[msg.sender] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePrice(uint _price) onlyowner {
|
function changePrice(uint _price) onlyOwner {
|
||||||
price = _price;
|
price = _price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -717,13 +717,13 @@ Abstract Contracts
|
|||||||
|
|
||||||
Contract functions can lack an implementation as in the following example (note that the function declaration header is terminated by `;`)::
|
Contract functions can lack an implementation as in the following example (note that the function declaration header is terminated by `;`)::
|
||||||
|
|
||||||
contract feline {
|
contract Feline {
|
||||||
function utterance() returns (bytes32);
|
function utterance() returns (bytes32);
|
||||||
}
|
}
|
||||||
|
|
||||||
Such contracts cannot be compiled (even if they contain implemented functions alongside non-implemented functions), but they can be used as base contracts::
|
Such contracts cannot be compiled (even if they contain implemented functions alongside non-implemented functions), but they can be used as base contracts::
|
||||||
|
|
||||||
contract Cat is feline {
|
contract Cat is Feline {
|
||||||
function utterance() returns (bytes32) { return "miaow"; }
|
function utterance() returns (bytes32) { return "miaow"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ custom types without the overhead of external function calls:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
library bigint {
|
library BigInt {
|
||||||
struct bigint {
|
struct bigint {
|
||||||
uint[] limbs;
|
uint[] limbs;
|
||||||
}
|
}
|
||||||
@ -880,7 +880,8 @@ custom types without the overhead of external function calls:
|
|||||||
|
|
||||||
|
|
||||||
contract C {
|
contract C {
|
||||||
using bigint for bigint.bigint;
|
using BigInt for BigInt.bigint;
|
||||||
|
|
||||||
function f() {
|
function f() {
|
||||||
var x = bigint.fromUint(7);
|
var x = bigint.fromUint(7);
|
||||||
var y = bigint.fromUint(uint(-1));
|
var y = bigint.fromUint(uint(-1));
|
||||||
|
@ -31,7 +31,7 @@ Internal Function Calls
|
|||||||
Functions of the current contract can be called directly ("internally"), also recursively, as seen in
|
Functions of the current contract can be called directly ("internally"), also recursively, as seen in
|
||||||
this nonsensical example::
|
this nonsensical example::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
function g(uint a) returns (uint ret) { return f(); }
|
function g(uint a) returns (uint ret) { return f(); }
|
||||||
function f() returns (uint ret) { return g(7) + f(); }
|
function f() returns (uint ret) { return g(7) + f(); }
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ of unused parameters (especially return parameters) can be omitted.
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
function f(uint key, uint value) { ... }
|
function f(uint key, uint value) { ... }
|
||||||
|
|
||||||
function g() {
|
function g() {
|
||||||
@ -541,7 +541,7 @@ It is planned that the stack height changes can be specified in inline assembly.
|
|||||||
|
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
uint b;
|
uint b;
|
||||||
function f(uint x) returns (uint r) {
|
function f(uint x) returns (uint r) {
|
||||||
assembly {
|
assembly {
|
||||||
@ -615,7 +615,7 @@ be just `0`, but it can also be a complex functional-style expression.
|
|||||||
|
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
function f(uint x) returns (uint b) {
|
function f(uint x) returns (uint b) {
|
||||||
assembly {
|
assembly {
|
||||||
let v := add(x, 1)
|
let v := add(x, 1)
|
||||||
|
@ -179,7 +179,7 @@ Mappings are already syntactically similar to arrays as they are, therefore it d
|
|||||||
|
|
||||||
An example of this would be::
|
An example of this would be::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
struct myStruct {
|
struct myStruct {
|
||||||
uint someNumber;
|
uint someNumber;
|
||||||
string someString;
|
string someString;
|
||||||
@ -218,7 +218,7 @@ Example::
|
|||||||
|
|
||||||
contract C {
|
contract C {
|
||||||
function f() returns (uint8[5]) {
|
function f() returns (uint8[5]) {
|
||||||
string[4] memory AdaArr = ["This", "is", "an", "array"];
|
string[4] memory adaArr = ["This", "is", "an", "array"];
|
||||||
return ([1, 2, 3, 4, 5]);
|
return ([1, 2, 3, 4, 5]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ Examples::
|
|||||||
|
|
||||||
S public x = S(1, 2);
|
S public x = S(1, 2);
|
||||||
string name = "Ada";
|
string name = "Ada";
|
||||||
string[4] memory AdaArr = ["This", "is", "an", "array"];
|
string[4] memory adaArr = ["This", "is", "an", "array"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ non-elementary type, the positions are found by adding an offset of `sha3(k . p)
|
|||||||
|
|
||||||
So for the following contract snippet::
|
So for the following contract snippet::
|
||||||
|
|
||||||
contract c {
|
contract C {
|
||||||
struct S { uint a; uint b; }
|
struct s { uint a; uint b; }
|
||||||
uint x;
|
uint x;
|
||||||
mapping(uint => mapping(uint => S)) data;
|
mapping(uint => mapping(uint => s)) data;
|
||||||
}
|
}
|
||||||
|
|
||||||
The position of `data[4][9].b` is at `sha3(uint256(9) . sha3(uint256(4) . uint256(1))) + 1`.
|
The position of `data[4][9].b` is at `sha3(uint256(9) . sha3(uint256(4) . uint256(1))) + 1`.
|
||||||
|
Loading…
Reference in New Issue
Block a user