This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

strict ANSI mode useless?



What it the strict ANSI mod for? I tried to compile 

#include <msp430f2618.h>

and get the error

"C:/ti/ccsv5/ccs_base/msp430/include/msp430f2618.h", line 1172: error #10: "#" not expected here

What is the sense of strict ANSI mode, when the compiler's files does not support it?

  • Hi Helge,

    I looked into rev. 1.5 of that file - and there are lots of lines commented out with '//' instead of '/*' and '*/'. Compiling with gcc -Wall -ansi -pedantic a C file (not C++) including that header deliveres lots of warnings like yours.

    Helge Kruse said:
    What is the sense of strict ANSI mode, when the compiler's files does not support it?

    I agree with you. I wished, those files where written more consequently conforming the standards.

    Kind regards,
    Joern.

  • Those files are not part of the compiler itself, so this is not quite the right forum for this issue.  I think this topic should be moved to the MSP forum.

  • Archaeologist said:

    Those files are not part of the compiler itself, so this is not quite the right forum for this issue.  I think this topic should be moved to the MSP forum.

    It is not only MSP headers that have the problem with compiling in the ansi strict mode.  I am trying to compile for 28335 (delfino), and it fails badly (there are so many error messages that I do not know where to start).

    And the faq wiki page suggests to compile with ansi mode enabled :

    http://processors.wiki.ti.com/index.php/C28x_Code_Generation_Tips_and_Tricks#Q:_My_code_worked_well_until_I_turned_on_optimization._What_could_be_the_issue.3F

  • Actually, that wiki page is not a suggestion to turn on strict ANSI mode, it is a suggestion to modify the source code to be more strictly conforming.

    The purpose of the compiler's "strict ANSI" mode is to allow the compiler to accept strictly conforming programs which were written without knowledge of the TI compiler, and which may happen to use identifiers that conflict with TI C extensions.  That is, if you have a program you know to be strictly conforming, you are supposed to be able to use the "strict ANSI" mode to get the compiler to accept it.

    The problem you are facing is that there are libraries that are not strictly conforming, and turning on "strict ANSI" mode will not make them so.  If you must use "strict ANSI" mode, you need to get the producers of those libraries to tighten up their ANSI conformance.

    If you are using a program developed for the TI environment, you probably do not need "strict ANSI" mode, so don't use it.