Re: Defining polymorphism vs. overloading

plph@caen.engin.umich.edu (Mark Montague)
Mon, 3 Sep 90 21:09:04 EDT

          From comp.compilers

Related articles
Defining polymorphism vs. overloading oliver@karakorum.berkeley.edu (1990-08-30)
Re: Defining polymorphism vs. overloading burley@world.std.com (1990-09-01)
Re: Defining polymorphism vs. overloading wright@gefion.rice.edu (1990-09-02)
Re: Defining polymorphism vs. overloading compilers-sender@esegue.segue.boston.ma.us (1990-09-03)
Re: Defining polymorphism vs. overloading hrubin@l.cc.purdue.edu (1990-09-03)
Re: Defining polymorphism vs. overloading px@fctunl.rccn.pt (1990-09-03)
Re: Defining polymorphism vs. overloading plph@caen.engin.umich.edu (1990-09-03)
Re: Defining polymorphism vs. overloading daveg@near.cs.caltech.edu (1990-09-03)
Re: Defining polymorphism vs. overloading dmw9q@uvacs.cs.Virginia.EDU (1990-09-05)
Re: Defining polymorphism vs. overloading pase@orville.nas.nasa.gov (1990-09-06)
Re: Defining polymorphism vs. overloading tub!wg@relay.EU.net (1990-09-06)
Re: Defining polymorphism vs. overloading pase@orville.nas.nasa.gov (Douglas M. Pase) (1990-09-06)
Re: Defining polymorphism vs. overloading ok@goanna.cs.rmit.OZ.AU (1990-09-07)
[10 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: plph@caen.engin.umich.edu (Mark Montague)
Keywords: design, polymorphism
Organization: University of Michigan Engineering, Ann Arbor
References: <9008310419.AA06194@karakorum.berkeley.edu>
Date: Mon, 3 Sep 90 21:09:04 EDT

Are the square braces in C polymorphic or overloaded? Which term should be
used? I am no expert, but my personal opinion is NEITHER. As a programmer
who has just begun delving into the mysteries of compiler construction, I
prefer to think of the square braces as a SHORTHAND NOTATION which is expanded
by the preprocessor (even though the preprocessor doesn't). So I imagine that
every expression of the form


myarray[index]


is silently transformed into


*(myarray+index)


before the compiler even sees it. Even though it probably doesn't happen
this way for most compilers, this fictional device lets me ignore questions
of polymorphism and operator overloading in a non-object-oriented language
such as C.


Mark Montague
plph@caen.engin.umich.edu
[In the C compilers I've seen subscripts are turned into the intermediate code
equivalent of *(a+b) very early in the compiler, typically as the intermediate
form is being built. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.