Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GCC ` backtick` CLI - what does it actually do ? Pin
k505417-Jul-20 5:38
mvek505417-Jul-20 5:38 
GeneralRe: GCC ` backtick` CLI - what does it actually do ? Pin
Vaclav_17-Jul-20 6:05
Vaclav_17-Jul-20 6:05 
GeneralRe: GCC ` backtick` CLI - what does it actually do ? Pin
Richard MacCutchan17-Jul-20 6:19
mveRichard MacCutchan17-Jul-20 6:19 
GeneralRe: GCC ` backtick` CLI - what does it actually do ? Pin
k505417-Jul-20 6:57
mvek505417-Jul-20 6:57 
GeneralUndefined reference GTK issue was Re: GCC ` backtick` CLI - what does it actually do ? Pin
Vaclav_17-Jul-20 7:35
Vaclav_17-Jul-20 7:35 
GeneralRe: GCC ` backtick` CLI - what does it actually do ? Pin
Richard MacCutchan17-Jul-20 21:54
mveRichard MacCutchan17-Jul-20 21:54 
QuestionDevelop VC++ for IPad Pin
_Flaviu15-Jul-20 7:01
_Flaviu15-Jul-20 7:01 
AnswerRe: Develop VC++ for IPad Pin
Richard MacCutchan15-Jul-20 22:56
mveRichard MacCutchan15-Jul-20 22:56 
GeneralRe: Develop VC++ for IPad Pin
_Flaviu16-Jul-20 0:56
_Flaviu16-Jul-20 0:56 
GeneralRe: Develop VC++ for IPad Pin
Richard MacCutchan16-Jul-20 1:37
mveRichard MacCutchan16-Jul-20 1:37 
QuestionFFMPEG encrypt & decrypt Video offline Pin
DARA ALAVI13-Jul-20 21:50
DARA ALAVI13-Jul-20 21:50 
AnswerRe: FFMPEG encrypt & decrypt Video offline Pin
Victor Nijegorodov13-Jul-20 21:55
Victor Nijegorodov13-Jul-20 21:55 
GeneralRe: FFMPEG encrypt & decrypt Video offline Pin
DARA ALAVI13-Jul-20 22:09
DARA ALAVI13-Jul-20 22:09 
GeneralRe: FFMPEG encrypt & decrypt Video offline Pin
Victor Nijegorodov13-Jul-20 22:23
Victor Nijegorodov13-Jul-20 22:23 
GeneralRe: FFMPEG encrypt & decrypt Video offline Pin
DARA ALAVI13-Jul-20 22:38
DARA ALAVI13-Jul-20 22:38 
QuestionDoes FreeRTOS have built-in support for queues that can hold variable sized elements? Pin
arnold_w12-Jul-20 10:06
arnold_w12-Jul-20 10:06 
AnswerRe: Does FreeRTOS have built-in support for queues that can hold variable sized elements? Pin
Richard MacCutchan12-Jul-20 21:14
mveRichard MacCutchan12-Jul-20 21:14 
AnswerRe: Does FreeRTOS have built-in support for queues that can hold variable sized elements? Pin
leon de boer21-Jul-20 19:32
leon de boer21-Jul-20 19:32 
QuestionWhat's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w10-Jul-20 1:28
arnold_w10-Jul-20 1:28 
AnswerRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
Josh Gray210-Jul-20 3:30
Josh Gray210-Jul-20 3:30 
the
readDataResultCallback
member of your structure is just a fancy pointer, either 32 or 64 bits long depending on your architecture, so it can only be initialised with the memory address of a function.

So you could have something like the following...

void OnState1(uint8_t* readData, uint16_t sizeOfReadData) 
{
...
}

stateMachineStep_s stateMachineSteps[3] = {
{STATE1,    10, 2, &OnState1} 
...
}


which, to be honest, is not significantly more typing. You could also use macros to generate some of the code but that comes with it's own issues.

C++11 and greater support lambda expressions which will allow you to initialise your structs with a similar syntax to your example but in that case you would have to swap your function pointer to an std::function<> type. If you don't have c++11 support the boost library offers a similar function pointer but without the nicer lambda syntax.

modified 10-Jul-20 10:24am.

GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w10-Jul-20 11:19
arnold_w10-Jul-20 11:19 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
k505410-Jul-20 11:52
mvek505410-Jul-20 11:52 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
Richard MacCutchan10-Jul-20 22:05
mveRichard MacCutchan10-Jul-20 22:05 
AnswerRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
CPallini12-Jul-20 20:33
mveCPallini12-Jul-20 20:33 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w12-Jul-20 23:52
arnold_w12-Jul-20 23:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.