Pelles C > General discussions

Compiler warning on comment?

(1/1)

John Z:
Here is one to consider:
I get this warning on compile in Pelles version 10 ... yes I know upgrade soon!  :)
-
C:\Program Files\PellesC\Files\vCardz\vCardz\search.c(1006): warning #1044: Trigraph '??!' converted to '|'.


due to this source line

--- Code: ---             { startrec = 0;} // back to the start (what about loop when doing directory??!!)
--- End code ---

I would not think the compiler would care what is in a comment... even though Level 2 and C11

Smallest program is not included since you can just paste the comment.  BUT if that doesn't work I'll post.

John Z

frankie:
Hello John,
this behavior is fully compliant with the standard, apart the warning that is just informational to advice you that a trigraph has been found and translated.
The C standards, from C89 up to C20, specify the the first phase of a 'unit translation' (read source file compilation), is the mapping of source file to source character set and the translations of trigraphs.
From C17 standard draft:

--- Quote ---5.1.1.2 Translation phases
.1 The precedence among the syntax rules of translation is specified by the following phases.
    1. Physical source file multibyte characters are mapped, in an implementation-defined manner, to
        the source character set (introducing new-line characters for end-of-line indicators) if necessary.
       Trigraph sequences are replaced by corresponding single-character internal representations.
    2. Each instance of a backslash character (\) immediately followed by a new-line character is
        deleted, splicing physical source lines (... omissis ...)
--- End quote ---
So in the very first phase trigraphs are translated to the internal representation, and a warning showed for each of them. This happens before the comment is stripped out from translation process.

John Z:
Thanks for the great explanation, especially the
--- Quote from: frankie on April 16, 2022, 04:29:55 PM ---This happens before the comment is stripped out from translation process
--- End quote ---

Got it!

Thank you,
John Z

frankie:
Anyway I have to admit that the warning is very annoying!  >:(  ;D ;D

Grincheux:
From Pelle's help file:



--- Quote --- C trigraph sequences 
All occurrences in a source file of the following sequences of three characters (called trigraph sequences) are replaced with the corresponding single character. They are meant for computers with limited character sets.
 
 TrigraphCharacter??=#??([??/\??)]??'^??<{??!|??>}??-~

--- End quote ---

Navigation

[0] Message Index

Go to full version