Unterminated extern "C" bracketing

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Unterminated extern "C" bracketing

447件の閲覧回数
johnstrohm
Contributor III

When declaring things in a header file that must be visible/linkable from both C and C++, the standard technique is:

#ifdef __cplusplus

extern "C" {

#endif

    /* declarations go here */

#ifdef __cplusplus

}

#endif

One occasionally sees an alternate form:

#if defined(__cplusplus)

extern "C" {

#endif

    /* declarations go here */

#if defined(__cplusplus)

}

#endif

In the USB 5.0 stack, files fsl_usb_ehci_hal.h and fsl_usb_khci_hal.h contain the first (opening) block but never the second (closing) block.  File fsl_usb_khci_hal.h contains it in two places.  If those header files are ever imported by a C++ module, the compiler will be very unhappy.

Admittedly, these two headers will probably not see C++ usage any time soon.

ラベル(1)
  • USB

タグ(2)
0 件の賞賛
1 返信

313件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi John,

Thanks for your report! I have passed it to our USB stack team, and this would be fixed in the next release.

Best Regards,

Kan

0 件の賞賛