pingus-devel
[Top][All Lists]
Advanced

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

Re: xmlChar uglyness


From: David Philippi
Subject: Re: xmlChar uglyness
Date: Tue, 10 Sep 2002 14:00:27 +0200
User-agent: KMail/1.4.1

On Monday 09 September 2002 18:35, Ingo Ruhnke wrote:
> else if (XMLHelper::equal_str (cur->name, "hotspot"))
> bool
> XMLHelper::equal_str (xmlChar* a, const char*)
> {
>         return !strcmp(reinterpret_cast<const char*>(cur->name),
> "hotspot"); }

> ...or something like that? Having dozens of reinterpret_cast<> in the
> code is not really what I want.


Sure, that's a bit shorter and makes it easier to change something if 
required. If the method is inline there isn't even any overhead.
I don't like reinterpret_cast<> very much either - it's a bit long. But it's 
definitly visible and far bettern then casting a const xmlChar* to a char*. 
While strcmp doesn't care wheter it's parameter is a const char* or a char* 
there are methods/functions out there who care. That's one of the main 
reasons why I'm changing C casts to C++ casts whenever I encounter them with 
a bit time remaining.

Bye David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]