4

I have the following code fragment.

function forward(address destination, bytes memory data) public { 
    (bool res, bytes memory retData) = destination.call(data);
    assert(res);
}

Since retData is not used, I am getting the following warning (compiled with solidity 0.5.0):

Compilation warnings encountered:

/Users/ivica/Documents/deka/hekate.reloaded/digits-node/contracts/IdentityProxy.sol:55:20:
Warning: Unused local variable.
        (bool res, bytes memory retData) = destination.call(data);
                   ^------------------^

Question: how to get rid of it?

5

Does this work for you?

pragma solidity ^0.5.2;

contract Test {

    function forward(address destination, bytes memory data) public { 
        (bool res, ) = destination.call(data);
        assert(res);
    }
}

Basically we are omitting the second assignment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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