2

The bittrex contract has the following code.
What does (a); and (val); mean?

contract Token {
    function balanceOf(address a) returns (uint) {
        (a);
        return 0;
    }

    function transfer(address a, uint val) returns (bool) {
        (a);
        (val);
        return false;
    }
}
0

2 Answers 2

5

It doesn't do anything. It just states the variable within brackets, which just evaluates to the value of the variable, but it's assigned to nothing. I compared the gas usage to a version of the contract which has that line commented out and it has identical gas costs to run the function, so it may be ignored by the compiler anyway.

They may have added it to silence compiler warnings about the function parameters not being used.

2
  • If it does nothing, it has to return false but it returns true.
    – Shavrany
    Commented Jun 20, 2018 at 14:49
  • It should never return true. If you're calling a transfer function on a contract which is returning true, then that contract isn't an instance of the code you provided. Commented Jun 21, 2018 at 2:51
0

Is used to avoid compilation warnings as AnAllergyToAnalogy's said.

Another way to do so is to comment the parameters name

function transfer (address /* a */, uint /* Val */) returns (bool)

In this case the body of the function can contain only the return statement.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.