Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

an array of size 37

Tags:

c

linux

posix

macos

typedef char    __darwin_uuid_string_t[37];

this piece of code is excepted from MacOS10.8/user/include/sys/_types.h I'm wondering why here is the number 37, but not a power of 2?

like image 416
wuhaochi Avatar asked Jan 15 '23 18:01

wuhaochi


1 Answers

UUIDs are 36-characters in length and hence form 37-character strings, including the null-character at the end.

A UUID is a 16-octet (128-bit) number. In its canonical form, a UUID is represented by 32 hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 digits and four hyphens).

like image 150
Anirudh Ramanathan Avatar answered Jan 22 '23 17:01

Anirudh Ramanathan