Suppose I have this code (C ++ or possibly C):
vector<int> my_vector; for (int i = 0; i < my_vector.size(); i++) { my_vector[i] = 0; }
I don’t care if this is done correctly. The important part is in the for-loop declaration. The compiler gives a signature mismatch / unsigned for this, since size () returns an unsigned int, not a signed one. How important is changing ito unsigned? I declare cycle counts as ints out of habit, but if this is a potential mistake, I forced myself to break the habit.
i
, - . , , , , .
, , - 32- 2 , unsigned . , , , , , / .
, i vector<int>::size_type. typedef :
vector<int>::size_type
typedef
typedef vector<int> VectorType; VectorType my_vector; for (VectorType::size_type i = 0; i < my_vector.size(); i++) { my_vector[i] = 0; }
, deque, . - , size_type, , , . . /, / , , .
deque
, INT_MAX. , int, .
INT_MAX
int
, , , , , , (), .
11111111 < 10000000
. , , ( ), - , , .
, .
, vector:: size_type; . .
Source: https://habr.com/ru/post/1711513/More articles:iPhone SDK: У меня проблемы с памятью, может ли кто-нибудь помочь новичкам исправить их? - memory-managementSQL Server 2005 wait type Sleep_Task - sql-serverBest CDate for VB6 - castingActionScript 3 Newb: TextInput enter an event? - eventshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1711512/source-control-repository-per-client-or-per-application&usg=ALkJrhijs1Q8jnRzFIIszzwq9vbtYZE_HwHow to send ruby source headers - content-typeHow to start a mailbox with an attached image? - javaНе хранит ли SqlDbType.DateTime секунды? - c#htaccess перенаправить строку запроса append? - redirectinternationalization library for ASP.NET applications - .netAll Articles