Re: Fetch function names & prototypes?
- From: TOUATI Sid <touati@xxxxxxxxxxxxx>
- Date: 19 Oct 2005 02:37:10 -0400
> Thanks.
> [Of course it's possible to construct a symbol table of functions,
> although in C++ the prototypes are found in the header files included
> by each module so there's no need. There's also an old trick: encode
> the argument types of each function as a byte string, put the byte
> string into the object file symbol table, and have the linker compare
> those byte strings and complain if they don't match. The linker doesn't
> have to understand the types, just see if they match. -John]
>
John,
The question is how do you encode the types. My intuition is that this
trick would not allow a perfect/accurate type checking. If types are
simple (say scalars), this trick would work. But if the function
arguments have complex data types, this would produce wrong type
mismatches.
S
[It's basically the same trick as C++ name mangling, represent the type
as a coded token string. If it's a complex type, the string may get long
but that's not a problem. I first saw this in the Dartmouth PL/I compiler
circa 1976, and it worked well. -John]
.
- References:
- Fetch function names & prototypes?
- From: codefixer
- Fetch function names & prototypes?
- Prev by Date: Re: Why context-free?
- Next by Date: RE: assembly optimizer tool
- Previous by thread: Fetch function names & prototypes?
- Next by thread: Re: terminological problem (EBNF & regular expressions)
- Index(es):
Relevant Pages
|
|