Re: Optimizing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Kalle Olavi Niemitalo <kon@xxxxxx> wrote:

> Although the second parameter is const void *, the language still
> allows the function to modify the object to which that points,
> provided that the object was not defined as const. 

Doesn't that defeat the whole purpose of const ?


BTW: let me add another question:


    const std::string str;

    void one(const std::string s)
    {
	str = s;
    }
    
    void two(const char* s)
    {
	one(s);
    }

    void three()
    {
	two("hello world");
    }


What actually happens here under the hood ? Is this reliable ?
(lifetime of the string object)


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@xxxxxxxx
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux