#define EDB_REC (byte*)(void*)&

89 views Asked by At

I'm programming on an Arduino Due using the Extended Database Library and encountered the following line in the example.

EDB_Status result = db.updateRec(1, EDB_REC logEvent);

I do not understand the EDB_REC logEvent part. What does EDB_REC do? (logEvent is just a struct) So I went to EDB_REC's implementation and got:

#define EDB_REC (byte*)(void*)&

which confuses me more because I have never seen such a #define statement.

Can someone explain me how those 2 code lines work? Searching on google I get only entries on how to define constants and simple functions with #define

Thanks!

1

There are 1 answers

3
Some programmer dude On

Remember that macros are just replaced in the source as a separate step before the compilers parser starts parsing the code.

That means db.updateRec(1, EDB_REC logEvent); will after macro expansion be seen by the compiler parser as db.updateRec(1, (byte*)(void*)& logEvent);