Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Limitation on the number of fields that can be set in MSGPACK_DEFINE_MAP #313

@kamontia

Description

@kamontia

Suppose you have a user-defined structure as follows (for simplicity, I've kept the definition straightforward):

struct UserDataType {
    uint8_t data1;
    uint8_t data2;
    // ...
    uint8_t data64;
    uint8_t data65;
    MSGPACK_DEFINE_MAP(
        data1,
        data2,
        // ...
        data64,
        data65
    )
}

When the MSGPACK_DEFINE_MAP macro is used to set more than 64 fields, the following error occurs. Within the limit of 64 fields, no error is encountered:

include/rpc/msgpack/preprocessor/tuple/to_seq.hpp:32:65: error: pasting "MSGPACK_PP_TUPLE_TO_SEQ" and "(" does not give a valid preprocessing token
   32 | #      define MSGPACK_PP_TUPLE_TO_SEQ_O_1(tuple) MSGPACK_PP_CAT(MSGPACK_PP_TUPLE_TO_SEQ_, MSGPACK_PP_VARIADIC_SIZE tuple) tuple

In the rpclib, what options are available when faced with this situation?

  1. Is it possible to increase the number of fields that can be set beyond 65?
  2. If not possible, what alternative ideas can be considered?

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