trigraph?? whats that??

Posted by Jack on Sat 07 Dec 2002 10:17 PM — 8 posts, 30,616 views.

#0
im a beginner in starting a mud, please someone help me figure this out.

interp.c:187:14: warning: multi-line string literals are deprecated
interp.c:1243:49: warning: trigraph ??' ignored
interp.c:1244:49: warning: trigraph ??' ignored
interp.c:1245:54: warning: trigraph ??' ignored
interp.c:1246:55: warning: trigraph ??' ignored
interp.c:1247:55: warning: trigraph ??' ignored
interp.c:4122: stray '\10' in program
Australia Forum Administrator #1
A trigraph is a throwback to the old days when people didn't have keyboards with lots of symbols.

eg.

??= is #
??( is [
??/ is \
??) is ]

and so on.

However in your case they are almost certainly caused by lines with incorrect line-endings. (eg. Unix lines on a DOS machine or vice-versa).

There are programs in the Utility area of the downloads section of this site to convert such files (unix2dos, dos2unix) that will fix up the line-endings.
#2
I have run into a similar problem, although I only have 3 trigraphs. One in act_move.c, one in act_wiz.c, and one in player.c These aren't really a big issue, since the MUD seems to work just fine, but I was wondering what I could do to get them out of the code for a cleaner compile. As suggested, I already tried changing from DOS to UNIX, but the errors remained. I did the conversion using Editpad.
Any help you could give would be great :)

Thanks for your time,
Kilsh
Australia Forum Administrator #3
Look closely at the line number that has the reported trigraph. If you can't spot it post the line(s) in question here.
#4
These are the warnings I get when I compile:
act_move.c:393:14: warning: trigraph ??> ignored
act_wiz.c:1666:49: warning: trigraph ??! ignored
player.c:1024:18: warning: trigraph ??) ignored

In act_move the problem is at the end of
char *rev_exit( sh_int vdir )

This is the line:
return "<???>";


In player.c, lines 1023 and 1024 are as follows:

bug("Affect_location_name: unknown location %d.", location);
return "(???)";

And the line in act_wiz is just a carriage return as far I can tell, its in void do_rstat.

I know I'm fairly new to programing, and this is the first trigraph warnings I've encountered, so I'm at a loss for what to do about them. It'd be great if you could help me out.
-Kilsh
Australia #5
Try:
return "<??\?>";
and
return "(??\?)";
Basically you need to escape the last ? so that it doesn't pick up the trigraph ??> or ??).

HTH,

Dave
#6
Changing the returns did clear up the errors :) Thanks for all the help!
-Kilsh
Australia Forum Administrator #7
Some relevant parts from the gcc man page are:


       -trigraphs
           Process trigraph sequences.  These are three-character
           sequences, all starting with ??, that are defined by
           ISO C to stand for single characters.  For example,
           ??/ stands for \, so '??/n' is a character constant
           for a newline.  By default, GCC ignores trigraphs, but
           in standard-conforming modes it converts them.  See
           the -std and -ansi options.

           The nine trigraphs and their replacements are

                   Trigraph:       ??(  ??)  ??<  ??>  ??=  ??/  ??'  ??!  ??-
                   Replacement:      [    ]    {    }    #    \    ^    |    ~



       -Wtrigraphs
           Warn if any trigraphs are encountered.  This option
           used to take effect only if -trigraphs was also speci-
           fied, but now works independently.  Warnings are not
           given for trigraphs within comments, as they do not
           affect the meaning of the program.


       -ansi
           In C mode, support all ISO C89 programs.  In C++ mode,
           remove GNU extensions that conflict with ISO C++.

           This turns off certain features of GCC that are incom-
           patible with ISO C89 (when compiling C code), or of
           standard C++ (when compiling C++ code), such as the
           "asm" and "typeof" keywords, and predefined macros
           such as "unix" and "vax" that identify the type of
           system you are using.  It also enables the undesirable
           and rarely used ISO trigraph feature.  For the C com-
           piler, it disables recognition of C++ style // com-
           ments as well as the "inline" keyword.


In summary, if you have -ansi mode on the compiler will process trigraphs, however whether or not you have that option set, you will be warned about them if the -Wtrigraphs warning is active.

You could suppress that by using the -Wno-trigraphs command-line option.