Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9008467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:56:39+00:00 2026-06-16T01:56:39+00:00

I have a structure in c++ which stores bytes like this: struct RemoteData {

  • 0

I have a structure in c++ which stores bytes like this:

struct RemoteData 
{
    /// some other fields here

    unsigned char* buf;
    int bufLen;     
};

And I need to send this data to remote service, written in C++, via thrift. I found three ways how to map this structure to thrift idl:

  1. Using container types like this:

    struct RemoteData 
    {
        1: list<BYTE> buf,
        ...
    }
    
  2. Using binary type:

    struct RemoteData 
    {
        1: binary buf,
        ...
    }
    
  3. Storing data in string type:

    struct RemoteData 
    {
        1: string buf,
        ...
    }
    

What is the best way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:56:40+00:00Added an answer on June 16, 2026 at 1:56 am

    The value contained in thrift string type must be UTF8-encoded, otherwise some client won’t be able to read it (Java thrift client for example).

    Thrift list<byte> type will be converted into std::vector<int8_t> in c++, but in other languages it will be not so good (for example, in java it will be compiled into suboptimal List<Byte>.

    The binary type is the best choice in terms of interoperability with clients in other languages and the correctness of protocol definition.

    Since all 3 definitions produce messages of roughly the same size, I’d go with binary: even if you don’t need interoperability with other languages now, you may need it in future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using EF4 and Linq I have a data structure which looks like this: parentid
I have a table in my database which stores a tree structure. Here are
Say there is a table which stores a hierarchical structure like this: item_id |
I have a structure which has 3 identifier fields and one value field. I
I have a staging database which stores the GEO location as the following structure
I have a MYSQL table which stores teams. Table structure: CREATE TABLE teams (
I have the following table structure: ID, User_ID, DateTime Which stores a user id
I have data structure which stores POD-structs (each instantiation stores a single type only,
I have questions which are represented like this in my SQL database : CREATE
I have an array of a structure which is supposed to store unique character

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.