Does it make sense to use _attribute__ ((nothrow)) inside extern C?

I have C code that is being called from C ++.
The title resembles the following:

#ifndef CLibH
#define CLibH

#ifdef __cplusplus
extern "C" {
#endif

//C API
void foo(void);
// ...

#ifdef __cplusplus
}
#endif

#endif

Since I already use extern C,
is there any use for adding a compiler attribute nothrow?

#ifndef CLibH
#define CLibH

#ifdef __cplusplus
extern "C" {
#endif

//C API
void foo(void) __attribute__((nothrow));
// ...

#ifdef __cplusplus
}
#endif

#endif

Is it extern Credundant?
Are there still advantages for use in these conditions?

+4
source share
1 answer

Yes Yes. From the gcc documentation:

, C qsort bsearch, .

0

Source: https://habr.com/ru/post/1653210/


All Articles