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.

Header Guards

Hi,

    I saw some of the header guards TI use, but I am not sure the standard format.  For example in stadint.h, it uses "_STDINT_H_", but stdlib.h uses "_STDLIB".  Another example is for pdk_keystone2_3_01_04_07, there is "ti/drv/qmss/qmss_qm.h". it uses "QMSS_QM_H_".  I feel there are three different kinds of the header guards, are they all work the same? 

    I am using CCS6.1 for EVMK2H.  MCSDK3.1.4.7

  • Yoyo Lee said:
    I feel there are three different kinds of the header guards, are they all work the same? 

    Yes.  They all work the same way.

    The ANSI standard for C reserves names that begin with an underscore '_' to the compiler implementation.  That is why the RTS header files supplied with the compiler use names like _STDINT_H or _STDLIB.  Otherwise, there is no published standard for the #define names used to avoiding including a header file more than once.

    Thanks and regards,

    -George