David Laight wrote:
On Tue, Aug 08, 2006 at 09:27:23PM +0200, Eric Pouech wrote:
what I don't like is that in order to plug a hole (casting from const
foo* to foo*), we create a bigger hole by allowing to cast from const
foo* to bar* (and the compiler will not give any warning)
if we want
Once qualifications are give, how hard it is to take them away, again!
Of course, if one were realising these small inline functions literally as
inline code, one would not add a const qualification for a few lines, only
to take it away again (with great difficulty).
Thus, one would not write:
On Mon, Aug 07, 2006 at 09:54:20PM +0100, Andrew Talbot wrote:
Although I accept that my opinion may not be universally shared :-), I
believe that it is better to turn -Wcast-qual on permanently and
double-cast the appropriate return values of the relevant wide-string
functions (strchrW(),
Marcus Meissner wrote:
I asked our gcc gurus.
- If you want to cast, do not use size_t but uintptr_t.
Or:
- Do not inline the function, and compile its file without -Wcast-qual.
- Fix the prototype to read extern inline const WCHAR *strrchrW( const
WCHAR *str, WCHAR ch )
Ciao,
Andrew Talbot wrote:
David Laight wrote:
On Mon, Aug 07, 2006 at 09:54:20PM +0100, Andrew Talbot wrote:
would like to submit a patch that, for example, changes strchrW() to:
extern inline WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
{
WCHAR *ret = NULL;
do { if (*str == ch)
On Tue, Aug 08, 2006 at 09:27:23PM +0200, Eric Pouech wrote:
what I don't like is that in order to plug a hole (casting from const
foo* to foo*), we create a bigger hole by allowing to cast from const
foo* to bar* (and the compiler will not give any warning)
if we want to go into this, then
Although I accept that my opinion may not be universally shared :-), I
believe that it is better to turn -Wcast-qual on permanently and
double-cast the appropriate return values of the relevant wide-string
functions (strchrW(), strrchrW(), strpbrkW(), memchrW() and memrchrW())
than to leave it
Andrew Talbot wrote:
[...]
So I
would like to submit a patch that, for example, changes strchrW() to:
extern inline WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
[...]
Yes, that was a typo: it should say changes strrchrW()
-- Andy.
On Mon, Aug 07, 2006 at 09:54:20PM +0100, Andrew Talbot wrote:
would like to submit a patch that, for example, changes strchrW() to:
extern inline WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
{
WCHAR *ret = NULL;
do { if (*str == ch) ret = (WCHAR *)(size_t)str; } while (*str++);
David Laight wrote:
On Mon, Aug 07, 2006 at 09:54:20PM +0100, Andrew Talbot wrote:
would like to submit a patch that, for example, changes strchrW() to:
extern inline WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
{
WCHAR *ret = NULL;
do { if (*str == ch) ret = (WCHAR
10 matches
Mail list logo