From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3668 invoked by alias); 30 Jan 2011 20:50:56 -0000 Received: (qmail 3655 invoked by uid 22791); 30 Jan 2011 20:50:55 -0000 X-SWARE-Spam-Status: No, hits=1.1 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX,SARE_HEAD_XWORD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from caprica.metux.de (HELO mailgate.caprica.metux.de) (82.165.128.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Jan 2011 20:50:50 +0000 Received: from mailgate.caprica.metux.de (localhost.localdomain [127.0.0.1]) by mailgate.caprica.metux.de (8.14.4/8.14.4) with ESMTP id p0UKlGKp020863 for ; Sun, 30 Jan 2011 21:47:17 +0100 Received: (from uucp@localhost) by mailgate.caprica.metux.de (8.14.4/8.14.4/Submit) with UUCP id p0UKl97P020856 for gcc-help@gcc.gnu.org; Sun, 30 Jan 2011 21:47:09 +0100 Received: (from weigelt@localhost) by nibiru.metux.de (8.12.10/8.12.10) id p0UKeMOQ019180 for gcc-help@gcc.gnu.org; Sun, 30 Jan 2011 21:40:22 +0100 Date: Sun, 30 Jan 2011 20:55:00 -0000 From: Enrico Weigelt To: gcc-help@gcc.gnu.org Subject: Re: Optimizing Message-ID: <20110130204022.GF29226@nibiru.local> Reply-To: weigelt@metux.de Mail-Followup-To: gcc-help@gcc.gnu.org References: <1296416236.32435.15.camel@sara> <878vy2dto4.fsf@Pulska.kon.iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878vy2dto4.fsf@Pulska.kon.iki.fi> User-Agent: Mutt/1.4.1i X-Terror: bin laden, kill bush, Briefbombe, Massenvernichtung, KZ, X-Nazi: Weisse Rasse, Hitlers Wiederauferstehung, 42, X-Antichrist: weg mit schaeuble, ausrotten, heiliger krieg, al quaida, X-Killer: 23, endloesung, Weltuntergang, X-Doof: wer das liest ist doof X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg00469.txt.bz2 * Kalle Olavi Niemitalo 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@metux.de mobile: +49 151 27565287 icq: 210169427 skype: nekrad666 ---------------------------------------------------------------------- Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme ----------------------------------------------------------------------