Coding standard for qdebug in libs

Boudewijn Rempt boud at valdyas.org
Mon Sep 14 09:39:04 BST 2015


On Tue, 8 Sep 2015, Jaroslaw Staniek wrote:

> On 8 September 2015 at 21:31, Friedrich W. H. Kossebau <kossebau at kde.org> wrote:
>> Am Samstag, 5. September 2015, 12:55:28 schrieb Jaroslaw Staniek:
>>> With increasing modularity it's quite important
>>> for our debugging needs to have logging categories.
>>
>> Agreed.
>>
>>> A scheme could be like
>>> {libnamelowercase}{Debug|Warning|Critical}()
>>
>> +1 for that scheme. Simply because that namespace-prefixing seems to match the
>> usual namespace-prefixing as done with classes/files, don't see another reason
>> for/against.
>>
>>> I also propose to use a libname prefix for the header name. This is
>>> what many bits in KF5 do. So we won't have to deal with dozens files
>>> prefixed with "Debug" soon (so libpigment's DebugPigment.h could
>>> become PigmentDebug.h or pigment_debug.h).

That's sort of fine, I don't have a real preference there. I still think that
having one debug category per library is a limitation, and we'll need categories
for debugging functional areas, not libraries, and funcational areas over-arch
libaries (whether that's good architecture, I don't know...)

>>
>> When I looked into debug porting for libs/ last week (still need to complete
>> end of next week, so anyone wants to take over meanwhile? no code yet written
>> here), I wondered if installed headers better should not include any debug-
>> only headers at all.
>
> *debug.h should not be installed. I see that KF5 does not install own headers.
>
>> But with publix/exported templates which need/better have debug statements
>> that might be unavoidable. Still not really sure though, it somehow seems
>> dirty to me :)
>
> Is there at least such a case in calligra.git? We can add a template
> specialization and keep the implementation in .cpp.

KoResourceLoader, I think.

I'm now porting libs to qCDebug. After thinking about it a bit,
I really, really, really don't like

vectorImageDebug(),

I think that

debugVectorImage()

is clearer and more grammatical as well. That may just be because we've 
had dbgCategory in Krita for ten years now, but this is the form I would
prefer to use.


Boudewijn



More information about the calligra-devel mailing list