坚固函数中的卷曲支架

发布于 2025-01-18 02:28:33 字数 649 浏览 2 评论 0原文

我想知道在这种情况下卷曲括号是什么意思?

uint64 configCount = s_configCount;
    {
      s_hotVars.latestConfigDigest = configDigestFromConfigData(
        address(this),
        configCount,
        _signers,
        _transmitters,
        _threshold,
        _encodedConfigVersion,
        _encoded
      );
      s_hotVars.latestEpochAndRound = 0;
    }```

他们为什么使用{}?为什么他们没有这样写代码:

uint64 configCount = s_configCount;
s_hotVars.latestConfigDigest = configDigestFromConfigData(address(this),configCount,_signers,_transmitters,_threshold,_encodedConfigVersion,_encoded);
s_hotVars.latestEpochAndRound = 0;

I would like to know what curly brackets mean in that case ?

uint64 configCount = s_configCount;
    {
      s_hotVars.latestConfigDigest = configDigestFromConfigData(
        address(this),
        configCount,
        _signers,
        _transmitters,
        _threshold,
        _encodedConfigVersion,
        _encoded
      );
      s_hotVars.latestEpochAndRound = 0;
    }```

Why did they use {} ? why they didn't wrote the code like this :

uint64 configCount = s_configCount;
s_hotVars.latestConfigDigest = configDigestFromConfigData(address(this),configCount,_signers,_transmitters,_threshold,_encodedConfigVersion,_encoded);
s_hotVars.latestEpochAndRound = 0;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋日私语 2025-01-25 02:28:33

卷曲牙套适用于

他们还分配了一个新的堆栈框架。因为小堆栈对EVM中的开发人员来说是一个痛苦。需要使用深度调用结构来范围范围,以避免堆叠太深的错误

Curly braces are for the scoping rules.

They also allocate a new stack frame. Because the small stack is a pain for developers in EVM. Scoping is needed with deep call structures to avoid stack too deep error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文