Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   compiler options to display types? (http://www.velocityreviews.com/forums/t439783-compiler-options-to-display-types.html)

bsd_mike 10-13-2005 09:41 PM

compiler options to display types?
 

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


Walter Roberson 10-13-2005 10:06 PM

Re: compiler options to display types?
 
In article <1129239704.566346.269840@g14g2000cwa.googlegroups .com>,
bsd_mike <bsd_mike@hotmail.com> wrote:

>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.
--
I am spammed, therefore I am.

Mike Wahler 10-14-2005 12:15 AM

Re: compiler options to display types?
 

"bsd_mike" <bsd_mike@hotmail.com> wrote in message
news:1129239704.566346.269840@g14g2000cwa.googlegr oups.com...
>
> 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



Marc Boyer 10-14-2005 12:26 PM

Re: compiler options to display types?
 
Le 13-10-2005, bsd_mike <bsd_mike@hotmail.com> a écrit*:
> 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

Michael Wojcik 10-14-2005 02:21 PM

Re: compiler options to display types?
 

In article <1129239704.566346.269840@g14g2000cwa.googlegroups .com>, "bsd_mike" <bsd_mike@hotmail.com> writes:
>
> 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

--
Michael Wojcik michael.wojcik@microfocus.com

The way things were, were the way things were, and they stayed that way
because they had always been that way. -- Jon Osborne


All times are GMT. The time now is 08:10 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.