Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!bu.edu!husc6!spdcc!esegue!compilers-sender From: plph@caen.engin.umich.edu (Mark Montague) Newsgroups: comp.compilers Subject: Re: Defining polymorphism vs. overloading Keywords: design, polymorphism Message-ID: <4c98dcd0b.001a92c@caen.engin.umich.edu> Date: 4 Sep 90 01:09:04 GMT References: <9008310419.AA06194@karakorum.berkeley.edu> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: plph@caen.engin.umich.edu (Mark Montague) Organization: University of Michigan Engineering, Ann Arbor Lines: 26 Approved: compilers@esegue.segue.boston.ma.us 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] -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.