Skip to content

SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT does not work with C++ #962

Closed
@guidovranken

Description

@guidovranken
#include <secp256k1.h>
#include <secp256k1_schnorrsig.h>

int main(void)
{
    secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT;
    return 0;
}

This compiles as C but not as C++.

clang++:

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

g++

In file included from x.cpp:2:0:
x.cpp: In function ‘int main()’:
/secp256k1/include/secp256k1_schnorrsig.h:93:1: error: initializer-string for array of chars is too long [-fpermissive]
 }
 ^
x.cpp:6:52: note: in expansion of macro ‘SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT’
     secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions