是否有一个C相当于皮尔斯'自卸车()方法中的数据::自卸车? [英] Is there a C equivalent to Perls' Dumper() method in Data::Dumper?

查看:102
本文介绍了是否有一个C相当于皮尔斯'自卸车()方法中的数据::自卸车?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从本质上讲,就是我正在寻找的是,让我做一些这样的功能:

Essentially, what I'm looking for is a function that would allow me to do something like this:

自卸车(some_obj); / *输出some_objs数据结构* /

Dumper(some_obj); /* outputs some_objs' data structure */

感谢。

推荐答案

C不支持任何一种反映开箱。此外,它不是在这个意义上键入难,一旦它编译成机器code,类型是不存在了(不像在一些高级语言)。你需要所有的符号和调试信息,以建立您的可执行文件,然后使用一些调试工具或库来检索此数据。

C doesn't support any kind of reflection out of the box. Also it's not hard typed in the sense that once it's compiled to machine code, types aren't there any more (unlike in some higher level languages). You need to build your executable with all the symbols and debug info and then use some debugging tool or library to retrieve this data.

我想只是使用estabilished调试程序,如Visual Studio调试器或GDB就会简单得多。

I suppose just using an estabilished debugger such as the Visual Studio Debugger or gdb would be much simpler.

这篇关于是否有一个C相当于皮尔斯'自卸车()方法中的数据::自卸车?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆