I am considering the aligned-alloc () explanation: http://en.cppreference.com/w/c/memory/aligned_alloc
void *aligned_alloc( size_t alignment, size_t size );
"Allocation of size bytes of the uninitialized storage whose alignment is set by alignment. The size parameter must be an integer multiple of alignment."
However, the sample code uses it like this:
int *p2 = aligned_alloc(1024, 10*sizeof *p2);
10 * sizeof * p is 40, so it is not an integer multiple of 1024.
What don’t I understand?
, , C11 : undefined, DR 460 , , : http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2072.htm
, , .
:
size, alignment alignment, , (C11, , undefined , DR 460).
size
alignment
, C11, DR 460, , "undefined" "" . , ", ". undefined.
, ( , , 1024 * sizeof *p2).
1024 * sizeof *p2
Source: https://habr.com/ru/post/1663191/More articles:I need to write a haskell function that duplicates each occurrence of a character in a string specified by the user. - functionConfusion about referencing two arguments - javaWhy does an ionic modal freeze the user interface when it's closed or shipped? - javascriptandroid: textColor doesn't actually work - androidGeneric diff objects that include lists with gdiff - haskellЛюбой способ использовать базовый конструктор в производном классе? - c++Why is "my @variable" inside sub and modified by sub / sub behaving so strangely - scopeTensorflow Saver() не сохраняется как .ckpt файл - tensorflowUpload image to server - Swift 3 - iosupload image to server using Alamofire - swift3All Articles