Function declaration as static and external "C"

Is it possible to declare a function as static and with external connection "C" in one line?

For example, with GCC, I can do this:

extern "C" {

  static void MyHandler (void)
  {
     // some code here
  }

}

And he does exactly what I want to do.

For aesthetic reasons, I no longer like the extern "C" {} block.

I can also write:

extern "C" void MyHandler (void) { ...

or

static void MyHandler (void) { ...

but if I combine them, then none of the following two works:

extern "C" static void MyHandler (void) {...
static extern "C" void MyHandler (void) {...

Q: Is there a way to combine two link modifiers without using an explicit “C” extern block?

+4
source share

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


All Articles