GCC 4.4.1, C99
I use size_t, and size_t- unsigned int. However, this depends on whether the 32-bit or 64-bit version is running.
size_t
unsigned int
I will use size_tto store the size of the buffer.
Thus, I do not think that it would be very portable if you would use all architectures.
Just a question using size_t32 or 64 bit. What situations can cause the most serious problem?
size_tguaranteed to be able to hold the number of bytes of any object in your implementation. Therefore, the return type sizeofis equal size_t.
sizeof
, .
, size_t sizeof() . :
sizeof()
unsigned long
sizeof(size_t)
memcpy
uintmax_t
, unsigned char. , size_t , .
unsigned char
malloc() read() size_t ssize_t . SIZE_MAX, SSIZE_MAX, sizeof (type-in-your-buffer) % zd % zu printf().
off_t ptrdiff_t/ssize_t, .
, . 32- 32 , 64- 64 . , - 32- size_t 32- , 64- .
ints, longs - . , (32 32- , 64- 64- Unix-, 32- 64- Windows).
, "" . "" .
size_t . . , sizeof(). size_t , 100%, , , .
"", , .
, size_t int (. ), , .
, size_t .
, , size_t , . , , , .
, , , 32- ( 64- ).
size_t.
, "int" 64-, 32-, int 32- .
Source: https://habr.com/ru/post/1722262/More articles:Should I use ImageMagick or GD2 with ImageAPI in Drupal? - phpDoes calculating the sum for decimal values ββvia Core Data not working properly? - iphoneRegexp for exceptions 101 and 110 - regexFrom arrayList to long [] - javaIPHONE: saving and extracting a dictionary of dictionaries from plist - iphoneRuby includes false and nil - ruby ββ| fooobar.comCan we resize size_t in C? - cCreating a very large XML file with Linq-to-XML and Linq-to-SQL - c #How is 65 translated to the character "A"? - cdetermining the position of the mouse in a window focus event - javascriptAll Articles