Questions about xdt-csource

Matthew Brush mbrush at
Mon Oct 17 16:49:14 CEST 2011

On 11-10-17 07:00 AM, Nick Schermer wrote:

>> The first concern was that embedding such a long string literal into the
>> source was not portable since the C90 and C99 standards only guarantee
>> support for a maximum string literal length of 509[2] and 4095[3]
>> characters, respectively.
> The string of the preferences dialog in xfce4-panel is 28700u and I've
> never head of any problems. Object size limit is 65535 btw and I think
> that's the one in question here.

No, there's a limit on string literal length I guess, as described in 
the standards and in the docs for the "-Woverlength-strings" warning of 
GCC here[1]:

"Warn about string constants which are longer than the “minimum maximum” 
length specified in the C standard. Modern compilers generally allow 
string constants which are much longer than the standard's minimum 
limit, but very portable programs should avoid using longer strings.

The limit applies after string constant concatenation, and does not 
count the trailing NUL. In C90, the limit was 509 characters; in C99, it 
was raised to 4095. C++98 does not specify a normative minimum maximum, 
so we do not diagnose overlength strings in C++.

This option is implied by -pedantic, and can be disabled with 

>> The second concern was the extra memory used by having the string containing
>> the XML data always stuck in memory, as opposed to having it read from a
>> file and then freed immediately once the GtkBuilder/GtkUIManager has parsed
>> it.
> IIRC content of the .DATA section is mmap-ed during startup, you can
> do the same for the xml file. Doubt memory size is an issue here
> (0.027 Mb for 28700 chars?)

Geany's Glade file is 563 KB, so a fair bit bigger.  I'm not sure about 
the other thing you said :)

>> So I was wondering if anyone could comment on whether, given the above, it's
>> still worth using xdt-csource to speed up startup time and simply
>> distribution for a program like Geany.
> Xdt-csource also strips the xml, which should improve processing, but
> I don't think you'll notice a difference, constructing the widgets is
> by far slower.
> That said, if you want a fast interface: use gtk directly and build it
> yourself. For preferences dialogs it only "guarantees" the content is
> available and quickly accessible (disk fragmentation wise).

Ok, thanks for the reply, it clears it up a little.  I think we'll 
probably end up not using xdt-csource anyway, since we're already 
loading lots of config files and stuff like this on startup.

Matthew Brush

More information about the Xfce4-dev mailing list