SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT does not work with C++ #962

issue guidovranken openend this issue on July 3, 2021
  1. guidovranken commented at 3:05 pm on July 3, 2021: none
    0#include <secp256k1.h>
    1#include <secp256k1_schnorrsig.h>
    2
    3int main(void)
    4{
    5    secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT;
    6    return 0;
    7}
    

    This compiles as C but not as C++.

    clang++:

    0x.cpp:6:52: error: initializer-string for char array is too long
    1    secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT;
    2                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3/secp256k1/include/secp256k1_schnorrsig.h:90:5: note: expanded from macro 'SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT'
    4    SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC,\
    5    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    6/secp256k1/include/secp256k1_schnorrsig.h:88:48: note: expanded from macro 'SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC'
    7#define SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC "\xda\x6f\xb3\x8c"
    8                                               ^~~~~~~~~~~~~~~~~~
    91 error generated.
    

    g++

    0In file included from x.cpp:2:0:
    1x.cpp: In function ‘int main()’:
    2/secp256k1/include/secp256k1_schnorrsig.h:93:1: error: initializer-string for array of chars is too long [-fpermissive]
    3 }
    4 ^
    5x.cpp:6:52: note: in expansion of macro ‘SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT’
    6     secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT;
    
  2. real-or-random commented at 8:18 pm on July 3, 2021: contributor

    I guess there’s an unwritten rule that the include files should work in C++ too… Maybe we should test this in CI.

    Here’s a related CI failure after merging the same PR #844 (when CI was running on the PR, we didn’t have -Werror yet…), which doesn’t deserve an issue on its own: https://github.com/bitcoin-core/secp256k1/runs/2978402299

    cc @jonasnick

  3. real-or-random referenced this in commit 792d7c4666 on Jul 4, 2021
  4. real-or-random cross-referenced this on Jul 4, 2021 from issue "Schnorrsig API overhaul" fixups by real-or-random
  5. real-or-random referenced this in commit 769528f307 on Jul 5, 2021
  6. jonasnick closed this on Jul 5, 2021

  7. dderjoel referenced this in commit 75a8292f2a on May 23, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 04:15 UTC

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