0

There is the following code declaration:

int (*oled_format)(unsigned short F_gfx, unsigned char* oled_data, size_t oled_len, ...);

used in situations such as below:

format_rc = display_port->dev->oled_format(cmd, oled_data, cmd_len, color);

What does this do? Clearly it returns an int, but there does not seem to be any function description outside of the header file.

Googling brought me to some C++ docs about explicit instantiation which are not very clear and sometimes vary syntactically: 1 , and 2

Cheetaiean
  • 901
  • 1
  • 12
  • 26
  • 1
    ```oled_format``` is a pointer to a function. [This answer](https://stackoverflow.com/questions/840501/how-do-function-pointers-in-c-work) should be a good overview how those work. – sj95126 Jul 16 '21 at 17:31
  • Thank you, that clears it up! – Cheetaiean Jul 16 '21 at 17:33
  • 1
    This could help you in the future, [cdecl](https://cdecl.org/?q=int+%28*oled_format%29%28unsigned+short%2C+unsigned+char+*%29). – alex01011 Jul 16 '21 at 17:34
  • 1
    fixed the first link – Cheetaiean Jul 16 '21 at 18:25
  • Please note that you've linked to C++ references, but C and C++ are different languages so they _will_ vary syntactically. The C resources already listed are much better references in this situation. – Chris Jul 16 '21 at 19:00

1 Answers1

0

It's the declaration of a function pointer.

For those who are interested, the following StackOverflow answer explains how C's function pointers work:

How do function pointers in C work?

jstedfast
  • 35,744
  • 5
  • 97
  • 110