小智 6
来自:检查符号表
whatis expr
打印表达式expr的数据类型.expr实际上没有被评估,并且它内部的任何副作用操作(例如赋值或函数调用)都不会发生.请参见表达式部分.
ptype expr
P型
打印表达式expr的类型描述.ptype与whatis的不同之处在于打印详细说明,而不仅仅是类型的名称.例如,对于此变量声明:
struct complex {double real; double imag;} v;
Run Code Online (Sandbox Code Playgroud)
这两个命令给出了这个输出:
(gdb) whatis v
type = struct complex
(gdb) ptype v
type = struct complex {
double real;
double imag;
}
Run Code Online (Sandbox Code Playgroud)