If you teach your structure to save itself from within its own scope (i.e. from its method), you will not need to reference the structure name anywhere and you can use the solution squidge offered you (if that's not ok then simply write a macro accepting two arguments -- the structure variable name and the member in the structure). If you don't want to write two lines of code (although I have no idea what two lines of code you mean) then write another macro that will execute the two relevant statements and you'll do it with one line of code.
#define SAVE_DATA(var, token) save_data(#token, var.token)
#define SAVE_DATA(var, token) save_data(#token, var.token)
To copy to clipboard, switch view to plain text mode
Bookmarks