關於vector 的size()的返回值的值
官方文檔的解釋如下:
The number of elements in the container.
Member type size_type
is an unsigned integral type.
所以我用int來和unsigned來進行比較的話,可能會出現問題,
這個在C++Primer裏面也有講.
大意就是溢出之類的.
不過也可以不用管的講.
The number of elements in the container.
Member type size_type
is an unsigned integral type.
所以我用int來和unsigned來進行比較的話,可能會出現問題,
這個在C++Primer裏面也有講.
大意就是溢出之類的.
不過也可以不用管的講.
原因分析: 沒有設置socket的廣播SO_BROADCAST屬性,或者設置失敗卻想當然的認爲是成功。這時sendto數據返回-1,errno等於1