is const function faster than non-const?

From: Yuming Ma (ma_yuming_at_yahoo.com)
Date: 12/08/03


Date: Mon, 8 Dec 2003 01:02:43 -0500

consider this:

class X
{
        void foo() const;
        void goo();
}

suppose that foo() and goo() has exactly the same content, is foo() faster
than goo()? what does compiler optomization does to const function?

thanks,

yuming,



Relevant Pages

  • Re: Virtual function and multiple inheritance
    ... method in Derived which is not in Foo and Goo. ... virtual int myFunc() ... I'll make a guess that these two vtables are specific for Derived. ...
    (microsoft.public.vc.language)
  • Re: URGENT fast answer needed
    ... It will work similarly to grep except that it performs string replacement in addition to matching, and it does not support regular expressions or reading from standard input. ... our command will be called strep. ... foo a b c d foo e ... We could replace all occurrences of foo with goo as follows: ...
    (comp.lang.c)
  • Re: Virtual function and multiple inheritance
    ... containing two __vfptr is for the simple reason to maintain the ... It could be used in place of either a Foo or a Goo object, ... I'll make a guess that these two vtables are specific for Derived. ...
    (microsoft.public.vc.language)
  • Re: Virtual function and multiple inheritance
    ... __vfptr for Foo contains Derived overridden virtual methods for Foo, ... itself's virtual methods implementation, and __vfptr for Goo contains Derived ... Here pF is a pointer to an object with the same memory layout as a Foo ...
    (microsoft.public.vc.language)
  • Re: Virtual function and multiple inheritance
    ... virtual int func(); ... class Derived: Foo, Goo { ... Here pF is a pointer to an object with the same memory layout as a Foo and pG is a pointer to an object with the same memory layout as a Goo. ...
    (microsoft.public.vc.language)