1

This question already has an answer here:

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;
    }
}

marked as duplicate by Ismael, Achala Dissanayake, Vignesh Karthikeyan, Richard Horrocks, mafrasi2 Jun 21 '18 at 10:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

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.

  • If it does nothing, it has to return false but it returns true. – Shavrany Jun 20 '18 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. – AnAllergyToAnalogy Jun 21 '18 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.

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