Use Pure function attribute #17230

issue JeremyRubin openend this issue on October 23, 2019
  1. JeremyRubin commented at 5:50 pm on October 23, 2019: contributor

    In #17218 (comment) @ryanofsky claims that the compiler probably can’t optimize certain calls like pindex->GetBlockHash().ToHex(). Using the gnu::pure (which is pretty widely supported) attribute would likely fix that & would be good documentation for functions that we don’t expect to have any side effects.

    Maybe we should look at the gnu::pure attribute (which have pretty wide support in gcc/clang/llvm and others, except MSVC) and noexcept, which would allow the compiler to better optimize such functions if this is an issue https://stackoverflow.com/questions/2798188/pure-const-function-attributes-in-different-compilers.

  2. JeremyRubin added the label Feature on Oct 23, 2019
  3. fanquake added the label Brainstorming on Oct 23, 2019
  4. fanquake commented at 6:01 am on April 27, 2020: member
    I’m going to close this for now. #18088 has pretty good agreement that we don’t want to be using GNU extensions, which would mean we cannot do this.
  5. fanquake closed this on Apr 27, 2020

  6. fanquake referenced this in commit e727c2bdca on May 4, 2020
  7. sidhujag referenced this in commit fae55b66f9 on May 5, 2020
  8. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me