"by the bytes" vs "in bytes"

"by the bytes" vs "in bytes"

本文关键字:bytes in vs the by      更新时间:2023-10-16
template<class CharType>
struct StringWithLength
{
    size_t    length;
    CharType* str_buf;
};

我想对字段长度添加一些注释。我有两个选择:

#1. "The field length is the size of str_buf by the byte" 
    (Consider "The worker is paid by the hour")
#2. "The field length is the size of str_buf in bytes"

从一个以英语为母语的人的角度来看,哪个更自然?

谢谢。

我都不会用。我会这样说:

length字段的值为缓冲区的大小,单位为字节。

字段本身并不像计算机中的所有数据一样"以字节表示"。它是以字节为单位的缓冲区大小(或文本大小)

我的母语不是英语,但我已经说了10多年英语,并且在英语国家生活了这么长时间,所以我想说,从我的经验来看,第2条更自然。