Ian Pilcher ian.pilcher@home.com writes:
typedef struct {
- INT index;
- CHAR sz[0];
+} GLYPHNAME;
+typedef struct {
- LONG UV;
- GLYPHNAME *name;
+} UNICODEGLYPH;
+typedef struct {
- INT size;
- UNICODEGLYPH glyphs[0];
+} UNICODEVECTOR;
Zero-size arrays are not portable, and the standard method of using a size of 1 doesn't work well with initialized data (lots of warnings). So you probably need to change your data structures a bit; also it would be nice to store all the preinitialized stuff, or at least the strings, in read-only memory to save a bit of swap space.
Alexandre Julliard wrote:
Zero-size arrays are not portable, and the standard method of using a size of 1 doesn't work well with initialized data (lots of warnings). So you probably need to change your data structures a bit; also it would be nice to store all the preinitialized stuff, or at least the strings, in read-only memory to save a bit of swap space.
I knew that the zero-size arrays were GCC-specific, but I thought that they were part of the C99 standard. Of course, I can't find the web site where I read that now, so maybe it was just my fevered imaginings.
I had hoped to avoid yet another layer of pointer referencing, but it looks like the language is going to force me into it. <sigh> If some- one there knows a way to accomplish this with portable C, please speak up. (At least this will get rid of the horrible "array of chars" syntax required to initialize a zero-length array in GCC.)
Separating the string data from their indices will allow them to be declared as const, so that should get them into the ".rodata" section of the resulting assembly; the Adobe Glyph List vector is already there. Is this what you mean by "read only memory"?
If the string data does not have the indices mixed in with it, I will probably just build the initial glyph list at run time which will avoid having it in two places, so all of the static data should be in ".rodata".
Let me know if this approach will work for you.
Thanks!