Re: A macro to add



On Thu, 2018-02-08 at 23:06 -0600, Pavlo Solntsev wrote:
Hi,

I found that I need to convert a bool variable to its string
representation, e.g. "FALSE" or "TRUE". I "invented" a macro:

#define G_BOOL_TO_STRING(x) (x ? "TRUE" : "FALSE")

I put this macro to ./glib/gmacros.h file and added a brief
description ./glib/docs.c

Everything looks good but gtk-doc ignores it. Do I need to explicitly
mention this macro in some file? If so, what file? BTW, do we need
this macro in glib?

You’d need to add it to docs/reference/glib/glib-sections.txt so that
gtk-doc knows where to include it in the index.

However, this isn’t something I’d be interested in including in GLib:
it’s just as easy to open-code this in your application, and
prescribing the string formats for people to use would mean half of all
applications would find the format inappropriate.

If you find the macro useful, keep it in a header in your own
application. Do not prefix it with ‘G_’ as that’s the GLib namespace;
use your own namespace.

Philip

Attachment: signature.asc
Description: This is a digitally signed message part



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