Re: Will C++ compilers ever be better than C compilers?

Daniel Villeneuve <danielv@crt.umontreal.ca>
3 Aug 1998 17:57:55 -0400

          From comp.compilers

Related articles
Will C++ compilers ever be better than C compilers? mayan@watson.ibm.com (1998-08-02)
Re: Will C++ compilers ever be better than C compilers? qjackson@wave.home.com (Quinn Tyler Jackson) (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? bill@amber.ssd.csd.harris.com (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? michael.ball@Eng.Sun.COM (Michael Ball) (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? danielv@crt.umontreal.ca (Daniel Villeneuve) (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? jeff@jeff-jackson.com (Jeff Jackson) (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? bob.morgan@digital.com (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? chase@naturalbridge.com (David Chase) (1998-08-03)
Re: Will C++ compilers ever be better than C compilers? terryg@uswest.net (1998-08-04)
Re: Will C++ compilers ever be better than C compilers? mayan@watson.ibm.com (1998-08-04)
Re: Will C++ compilers ever be better than C compilers? chase@naturalbridge.com (David Chase) (1998-08-04)
[4 later articles]
| List of all articles for this month |

From: Daniel Villeneuve <danielv@crt.umontreal.ca>
Newsgroups: comp.compilers
Date: 3 Aug 1998 17:57:55 -0400
Organization: Compilers Central
References: 98-08-011
Keywords: C, C++, performance

mayan@watson.ibm.com (Mayan Moudgill) writes:


> Some of us were having an argument about the performance of C++
> vs. C programs, and I made the statement that C programs would
> be faster than C++ programs, because of the compilers. The rebuttal
> was that
> "you can always write C++ programs in the C-like subset
> [C + classes + in-lining + const], and the performance
> would be the same".


Besides considering the practical aspects of compiler implementation,
there are also aspects of the C++ language that might affect the way a
C++ compiler deals with C-like code. Taken from the CD2 of C++:


1.8 Program execution
18When calling a function (whether or not the function is inline), there
    is a sequence point after the evaluation of all function arguments (if
    any) which takes place before execution of any expressions or state-
    ments in the function body. There is also a sequence point after the
    copying of a returned value and before the execution of any expres-
    sions outside the function9). Several contexts in C++ cause evalua-
    tion of a function call, even though no corresponding function call
    syntax appears in the translation unit. [Example: evaluation of a new
    expression invokes one or more allocation and constructor functions;
    see _expr.new_. For another example, invocation of a conversion func-
    tion (_class.conv.fct_) can arise in contexts in which no function
    call syntax appears. ] The sequence points at function-entry and
    function-exit (as described above) are features of the function calls
    as evaluated, whatever the syntax of the expression that calls the
    function might be.


Doesn't this paragraph imply that a C++ compiler is more constrained
that a C compiler when dealing with complex expressions, even if such
expressions only contain C constructs?
--
Daniel Villeneuve
Graduate student in Operations Research
Ecole Polytechnique de Montreal
[I don't think so. C has its own sequence point rules which are similar
to this. -John]




--


Post a followup to this message

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