Re: [Vala] gross string literals



* Jared Moore wrote, On 23/06/08 22:45:
Hi,

If you use gcc, it should intern the string so it is only stored once
in the final object file.

Example:

#include <stdio.h>
int main() {
      if ("asdf" == "asdf") {
              printf("Interning works!\n");
      }
      return 0;
}
  
Yeah, it was the size that was of concern, and it will not get intern'd
across shared libraries - I guess not against static libs (dunno).

David Givens points out that C99 requires only 4K to be inlined, noting
that larger initializers seem to work.

I'll file a bug asknig that extern be used instead of #define.

Sam
Jared Moore

On Tue, Jun 24, 2008 at 2:28 AM, Sam Liddicott <sam liddicott com> wrote:
  
protected static const string xmldef="blah";

is implemented in the C .h file as:
#define PHONE_UI_GLADE_xmldef "blah"

I get uneasy because in some of my cases the string could be a few
thousand characters long.

I'd rather it was implemented directly as a string constant, with
"extern" in the header file.

Sam



_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list


    




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