Placement of declarations



The latest CVS updates contain many instances where variables are being declared after executable statements. While this is acceptable in some compilers such as C++, it is not legal in many legacy compilers.

Are we expected to be able to compile with legacy compilers or should these occurrences be corrected?

Examples:

@line 200 in dia_dirs.c

const gchar *

dia_message_filename (const gchar *filename)

{

  gchar *tmp;

#if GLIB_CHECK_VERSION(2,6,0)

  tmp = g_filename_display_name(filename);

#else

  gsize num_read;

  tmp = g_filename_to_utf8(filename, -1, &num_read, NULL, NULL);

  if (tmp == NULL) {

    gchar *ellipsis;

    /* Best effort at displaying filename: Display as must as is readable */

    g_utf8_validate(filename, -1, &ellipsis);

    tmp = g_filename_to_utf8(filename, ellipsis-filename, NULL, NULL, NULL);

    ellipsis = g_strdup_printf(_("%s<illegal characters>..."), tmp);

    g_free(tmp);

    tmp = ellipsis;

  }

#endif

  /* Stick in the quark table so that we can return a static result

   */

  GQuark msg_quark = g_quark_from_string (tmp);ß-----------------------------------out of place in both cases of the #if

  g_free (tmp);

  tmp = (gchar *) g_quark_to_string (msg_quark);

  return tmp;

}



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