Are ISO C90 compilers still meant to be supported?



Hi GNOME developers,

I am currently trying to build binary packages of GNOME-2.10 for NetBSD-1.6.2, which still uses gcc-2.95 as the default C compiler.

As you perhaps know, ISO C90 does not allow code intermixed with declarations, but your code occasionally contains some. It would be great if you tried to compile the official releases with an ISO C90 compiler, such as gcc-2.95.

Example 1:
    gchar *s1 = g_strdup("s1");
    if (strcmp(s1, "s1) == 0) { ... }
    gchar *s2;

Example 2 (tricky):
    gchar *s1;;
    gchar *s2;

    /* note the double ;; behind s1. The second semicolon */
    /* is an empty statement by the grammar of C.         */

Another issue are macros with a variable number of arguments.
Don't say:
#  define PRINT(fmt, ...) fprintf(fmt, ## __VA_ARGS__)
but:
#  define PRINT(fmt, ...) fprintf(fmt , ## __VA_ARGS__)
The space is necessary, as documented in the gcc-2.95 info page. But I didn't know it either for a long long time.

I think NetBSD-1.6.2 is not the only platform that uses a C90 compiler by default, so it's really worth the effort.

Greetings,

Roland



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