compiler options to display types?

B

bsd_mike

I am working with some purchased source code which
contains types which are structures which themselves
contain structures and even more structures.
Each field in the structure is itself its own datatype.

Is there a tool I can use that I can wrap a structure
and have it dump out the composition based on basic
types?

Thanks,
Mike
 
W

Walter Roberson

bsd_mike said:
I am working with some purchased source code which
contains types which are structures which themselves
contain structures and even more structures.
Each field in the structure is itself its own datatype.
Is there a tool I can use that I can wrap a structure
and have it dump out the composition based on basic
types?

Standard C makes no attempt to be "reflective" -- no attempt, that
is, to allow you to use your program to examine your program.
And anything having to do with compiler options is going to be
compiler specific, and this newsgroup only talks about standard (portable) C.


It -is- within the rhelm of possibility to use standard C to write
a program whose input is the program you want analyzed. That analysis
program would have to be a close approximation of being a compiler,
as it would have to know about conditional compilation and about
all the ways C types can be built up, it would have to know about
default typing, and it would have to know about scoping rules.
I don't think I could name a suitable program, but it would not surprise
me if one existed.
 
M

Mike Wahler

bsd_mike said:
I am working with some purchased source code which
contains types which are structures which themselves
contain structures and even more structures.
Each field in the structure is itself its own datatype.

Is there a tool I can use that I can wrap a structure
and have it dump out the composition based on basic
types?

Perhaps (have you asked Google?). But creating such a
tool would imo be a good exercise. And by the time
you're done, you'd be well on the way to writing a
compiler. :)

-Mike
 
M

Marc Boyer

Le 13-10-2005 said:
I am working with some purchased source code which
contains types which are structures which themselves
contain structures and even more structures.
Each field in the structure is itself its own datatype.

Is there a tool I can use that I can wrap a structure
and have it dump out the composition based on basic
types?

For which purpose ?
Any reasonnable debuger will show you the composition
of variables of a given type. It can help you to
understand a non/bad documented code.

Marc Boyer
 
M

Michael Wojcik

I am working with some purchased source code which
contains types which are structures which themselves
contain structures and even more structures.
Each field in the structure is itself its own datatype.

Is there a tool I can use that I can wrap a structure
and have it dump out the composition based on basic
types?

Not as part of the standard language, but you may want to try Doxygen,
a free documentation generator (similar to javadoc but for a variety
of languages). It has an "automatic" mode where it generates HTML
documentation from unannotated source; you can use the result to
examine a structure type or variable and drill down through its com-
ponent types.

http://www.doxygen.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top