关于typedef用法
有两个地方讲的挺好的
https://www.zhihu.com/question/29798061/answer/144423125
https://blog.csdn.net/superhoy/article/details/53504472
struct tagPOINT1
{
int x;
int y;
};
struct tagPOINT1 p1;
typedef struct tagPOINT
{
int x;
int y;
}POINT;
POINT p1; // 这样就比原来的方式少写了一个struct,比较省事,尤其在大量使用的时候
上面第二种的写法以前写过,却知其然不知所以然。
需要注意typedef与#define的区别,define只是简单的编辑器文本替换
在vivadoHLS的程序中也有使用,例如
#define IN_A_ROWS 5
#define IN_A_COLS 5
#define IN_B_ROWS 5
#define IN_B_COLS 5
typedef char mat_a;
typedef char mat_b;
void matrix_mult(
mat_a a[IN_A_ROWS][IN_A_COLS],
mat_b b[IN_B_ROWS][IN_B_COLS],
mat_prod prod[IN_A_ROWS][IN_B_COLS])//定义函数入口