malloc

#include <iostream>
#include "stdint.h"

typedef struct {
uint16_t param_count;
uint16_t result_count;
uint16_t param_cell_num;
uint16_t ret_cell_num;
/* types of params and results */
uint8_t types[1];
} WASMType;

typedef struct {
uint16_t param_count;
uint16_t result_count;
uint16_t param_cell_num;
uint16_t ret_cell_num;
/* types of params and results */
uint8_t types[];
} WASMType2;

typedef struct {
uint16_t param_count;
uint16_t result_count;
uint16_t param_cell_num;
uint16_t ret_cell_num;
/* types of params and results */
uint8_t types[0];
} WASMType3;

int main() {
std::cout << sizeof(WASMType) << std::endl;
std::cout << sizeof(WASMType2) << std::endl;
std::cout << sizeof(WASMType3) << std::endl;
return 0;
}
posted @ 2021-11-15 14:25  zJanly  阅读(74)  评论(0编辑  收藏  举报