"by bytes"vs"in bytes"

xml*_*lmx 0 c++ comments coding-style

template<class CharType>
struct StringWithLength
{
    size_t    length;
    CharType* str_buf;
};
Run Code Online (Sandbox Code Playgroud)

我想在字段长度上添加一些注释.我有两个选择:

#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"
Run Code Online (Sandbox Code Playgroud)

从英语母语人士的角度来看哪个更自然?

谢谢.

Jon*_*eet 8

我也不会用.我会说:

length字段的值是缓冲区的大小,以字节为单位.

字段本身不是"以字节表示",而是计算机中的所有数据.它是缓冲区大小(或文本大小,或其他),以字节为单位.