podivne chovani freebsd g++

Martin Horcicka horcicka at freebsd.cz
Wed Sep 1 10:29:47 CEST 2004


Ahoj,

Radim Kolar (2004-08-31 20:16 +0200):

> freebsd g++ 3.4 nebo 3.3 nechce provest auto-konverzi parametru na cost pri 
> volani funkce, coz je naprosto normalni vec pouzivana snad v kazdem softu.
...
> normalizemime.cc:504: error: invalid conversion from `char**' to `const 
> char**'

no, tohle je trochu problematicka vec. Nevim, zda je mezi C a C++ v tomto 
pripade rozdil, ale v novem standardu C (ISO/IEC 9899/1999) je na strane 93 
nasledujici priklad:

---
EXAMPLE 3 Consider the fragment:

const char **cpp;
char *p;
const char c = 'A';

cpp = &p;	// constraint violation
*cpp = &c;	// valid
*p = 0;		// valid

The first assignment is unsafe because it would allow the following valid code 
to attempt to change the value of the const object c.
---

Zrejme bude v tomto pripade nutne rucne pretypovat.

Martin



More information about the Users-l mailing list