“by bytes”vs“in bytes”

时间:2012-12-20 11:20:30

标签: c++ coding-style comments

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"

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

感谢。

2 个答案:

答案 0 :(得分:8)

我也不会用。我会说:

  

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

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

答案 1 :(得分:2)

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