Re: Modified Proposal for Context Sensitive Function Calls


Subject: Re: Modified Proposal for Context Sensitive Function Calls
From: Stickley, John (john_stickley@mentorg.com)
Date: Wed Nov 20 2002 - 11:29:27 PST


Kevin,

Kevin Cameron x3251 wrote:

Each instance of a module can have different parameters, so things like

array bounds can be different for every version of a routine/task in
that

module and consequently they may get code generated seperately.

This is a valid point.

So at this point, I would propose that we make a tradeoff.
Do we support a simpler static binding technique that only supports
simpler
non-parametrized data types or do we generalize support for the cases
you mention ?

I put out the following challenge to all those on the reflector:
Come up with solution that requires no API extensions and solves Kevin's
issue
above.

One thing I'm thinking is that the final answer may well depend on how
we ultmately represent packed array structures in C. If the data
structure
representing them is the same and things like array bounds are
dynamically
at run-time handled through accessors and run-time checking, then we may
well still be able to get away with a single one-fits-all stub funciton.

If this is not possible, we may yet need to add a dynamic function
pointer binding
API. I do agree with Bassam's assertion that, aside efficiency, other
factors
need to come into play in how we design our solution. Those factors are,
not adding to the existing API, ease-of-use, can we describe the
interface in
under 5 minutes (Stuart's suggestion), etc.

Am I missing something ? Even pure C++ with all its efficiency

only has one copy of code in a method that reused with all

caller sites and instantiations of its containing class.

    

Virtual functions are the C++ method of addressing this kind of problem,

i.e. the method code varies by subclass but you can call one virtual

function to get to it when you don't know which subclass you actually

have.

Actually I think it is the fact that C argument types are always static
and so
it never becomes an issue. The only place where paramatrization of types
comes into play is for templates and for that case, a separate function
is
generated for each combination of templates that are in use by the
application.

-- johnS

                                                           __

                       ______ | \

______________________/ \__ / \

                                \ H Dome ___/ |

John Stickley E | a __ ___/ / \____

Principal Engineer l | l | \ /

Verification Solutions Group | f | \/ ____

Mentor Graphics Corp. - MED C \ -- / /

17 E. Cedar Place a \ __/ / /

Ramsey, NJ 07446 p | / ___/

                                 | / /

mailto:John_Stickley@mentor.com <mailto:John_Stickley@mentor.com> \
/

Phone: (201)818-2585 \ /

                                   ---------



This archive was generated by hypermail 2b28 : Wed Nov 20 2002 - 11:34:03 PST