D
davej
Hi,
I've been working on an opensource project for most of this year. The
group has adopted the use of macros in place of function calls when
wanting to simplify a function.
#define get_sensor_values(s1, s2, s3) \
do { \
if(s1>s2) { \
if(s->e != NULL { \
id = s3->id; \ OID defined\n"); \
} \
} \
..... this continues for many lines
if(error)\
return(-1);
} while(0)
int process_sensor_data(n, p, s1, s2, s3)
{
..
..
get_sensor_values(s1, s2, s3);
..
..
return(OK);
}
I consider this obfuscation. For starters the macro hides one of the
return paths from the function. Second the use of macros has become
pervasive in replacing function calls.
I'd like to hear opinions on this. Are there any web references I
can use?
Thanks Much
DaveJ
I've been working on an opensource project for most of this year. The
group has adopted the use of macros in place of function calls when
wanting to simplify a function.
#define get_sensor_values(s1, s2, s3) \
do { \
if(s1>s2) { \
if(s->e != NULL { \
id = s3->id; \ OID defined\n"); \
} \
} \
..... this continues for many lines
if(error)\
return(-1);
} while(0)
int process_sensor_data(n, p, s1, s2, s3)
{
..
..
get_sensor_values(s1, s2, s3);
..
..
return(OK);
}
I consider this obfuscation. For starters the macro hides one of the
return paths from the function. Second the use of macros has become
pervasive in replacing function calls.
I'd like to hear opinions on this. Are there any web references I
can use?
Thanks Much
DaveJ