This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: suggestion for new __attribute__ format archetype


  In message <20000818113500.G15944@linuxcare.com.au>you write:
  > glib and gtk+ make fairly heavy use of this idiom for passing a
  > variable-length list of parameters to a function:
  > 
  >   g_strconcat("hello", " ", "world", NULL);
  > 
  >   gtk_object_new("GtkButton", "x", 40, "y", 50, NULL);
  > 
  > I left the terminating NULL off the other day, which produced a
  > sigsegv as you would expect.  It occurred to me that perhaps gcc could
  > know about this null-terminated list idiom in the same way it knows
  > about printf. =20
  > 
  > I'd suggest that perhaps it should even require that the last
  > parameter be known to be null at compile time.  This:
  > 
  >   char *addspace(char const *a, char const *b) {
  >     return g_strconcat(a, " ", b);
  >   }
  > 
  > might be OK if b was null, but for this idiom it would be a suspicious
  > usage and deserves a warning.
  > 
  > I though this would be a nice feature; make of it what you will.
We in principal approved a patch from Marc Espie to do this, but we
requested the patch be updated so that it would apply to the current
sources.  Marc hasn't done that, so the patch hasn't been integrated.

Would you be willing to update the patch so that it worked with the
current sources?

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]