David G. Wiseman

Ansi C: Stay Tuned for This Important Message


Jeffrey Haemer reporting on Posix, in <13501@cs.utexas.edu>:

       Stay_Tuned_for_This_Important_Message

       If you haven't yet had the pleasure of internationalizing applica-
       tions, chances are you will soon.  When you do, you'll face messaging:
       modifying the application to extract all text strings from external
       data files.  The sun is setting on

            main()
            {
                    printf("hello, world\n");
            }

       and we're entering a long night of debugging programs like this:

            #include 
            #include 
            #include "msg.h" /* decls of catname(), etc. */
            #define GRTNG "hello, world\n"
            nl_catd catd;

            main()
            {
                    setlocale(LC_ALL, "");
                    catd = catopen(catname(argv[0]), 0);
                    printf(catgets(catd, SETID, MSGID, GRTNG));
                    catclose(catd);
                    exit(0);
            }

       This, um, advance stems from a desire to let the program print

            ch`o c'c ^ng

       instead of

            hello, world

       when LANG is set to ``Vietnamese.''


We observe that in order to get past a discriminating ANSI compiler,
(eg. gcc -Wall -ansi -pedantic) "hello world" has already become:

#include 

int
main()
{
	(void) printf("hello world\n");
	return 0;
}

[Or do I also need to include stddef.h?]

	Mark.

Ha, ha, ha. Take me back to [ the alphabetic list ] [ the date-ordered list ].