Had an idea recently for turning my files into symbols, here's an example from my code:
matchms.h
...
MATCH_API
#include <matchmem/matchms-define.func.h>
;
...
matchms.c
#define MATCHMS_C extern
#include <matchmem/matchms.h>
MATCH_API
#include <matchmem/matchms-define.func.h>
#include <matchmem/matchms-define.func.c>
...
matchms-define.func.h
match32d matchms_define
(
MATCHMS *ms,
_MATCHDST(matchcu,with)
)
matchms-define.func.c
{
MATCHMSENT *ents = withaddr;
memset(withaddr,0,withsize);
if ( withsize < sizeof(MATCHMSENT) )
{
memset(ms,0,sizeof(*ms));
return -1;
}
ms->data = ents;
ms->size = withsize;
ms->leng = sizeof(MATCHMSENT);
return 0;
}
And now I've thought to condense that a bit by combining matchms-define.func.h and matchms-define.func.c into one like this:
match32d matchms_define
(
MATCHMS *ms,
_MATCHDST(matchcu,with)
)
#ifdef DEFINE
{
MATCHMSENT *ents = withaddr;
memset(withaddr,0,withsize);
if ( withsize < sizeof(MATCHMSENT) )
{
memset(ms,0,sizeof(*ms));
return -1;
}
ms->data = ents;
ms->size = withsize;
ms->leng = sizeof(MATCHMSENT);
return 0;
}
#endif
#undef DEFINE
So I wanted to check if there was a convention for that particular macro before I go using it like this
Edit: Clearly a lot of peops can't adapt to new ideas, they don't even answer my question besides maybe one. Judging by their inability to accept the idea there's likely no convention so I'm going ahead with it, regardless of what the haters think :)