[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Byte order conversions
From:       Richard Smith <kde () metafoo ! co ! uk>
Date:       2004-10-29 0:19:04
Message-ID: 200410290119.04712.kde () metafoo ! co ! uk
[Download RAW message or body]

Hi,

On Thursday 28 October 2004 08:00, Szombathelyi György wrote:
> Richard Smith wrote:
> > The KBE2ME_nn macros and the like could just as well be inline functions.
> > That'd be better for debugging; you'd be able to call them from gdb, and
> > step into them. I personally would prefer more readable/obvious
> > function/macro names.
>
> I hope these functions doesn't need any debugging.

It's confusing to be debugging and find something that looks like a function 
call takes you somewhere with a different name. Macros are strongly 
discouraged in C++ anyway.

> In contrast I don't want names like KBigEndianToMachineEndian. Personal
> taste, I think.

Sure. But when reading other people's code, I'd rather see
  Q_INT32 x = kFromBigEndian( bigEndianInt );
than
  Q_INT32 x = KBE2ME_32( bigEndianInt );

The former is readable, the latter requires you to look up what KBE2ME_32 is 
if you've not seen it before, or don't remember, or whatever.

> Actually I took the function names from MPlayer's own bswap.h and
> prefixed them with 'K'.

Oh. Is the code LGPL-compatible? If not, it can't go in kdelibs/kdecore.

> > I'd prefer more verbose names. And making them static will result in huge
> > bloat if the compiler decides to make out-of-line copies (eg for
> > debugging purposes).
>
> These functions are so small, is that really matters?

Well, not much, but the 'static' is gaining nothing and may be costing some 
disk space for every file that includes them.
-- 
Thanks,
Richard
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic