From kde-devel Fri Oct 29 08:51:02 2004 From: =?ISO-8859-1?Q?Szombathelyi_Gy=F6rgy?= Date: Fri, 29 Oct 2004 08:51:02 +0000 To: kde-devel Subject: Re: Byte order conversions Message-Id: <41820476.6050205 () freemail ! hu> X-MARC-Message: https://marc.info/?l=kde-devel&m=109903990226745 Richard Smith wrote: > 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. > For simple things they're useful. > >>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. > > It contains code from GLIBC, which is LGPL, and also I don't know that some very simple macro definitions are really causes license problems. But if I change names, and drop macros in favour of some inline functions, these issues should gone. >>>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. And if they're not static and not inlined, won't they show up on the symbol table of the binary? P.S: Please post any reply to kde-core-devel@kde.org, I posted the code there for inclusion in kdelibs. http://lists.kde.org/?l=kde-core-devel&m=109894770108715&w=2 Bye, György >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<