M
Michael B Allen
Is there a standard method for supressing warnings regarding unused
parameters? I have a function that might be called hundreds of thousands
of times that looks like this:
const void *
idx_byte(const void *p, int idx, void *context)
{
return (unsigned char *)p + idx;
}
This generates a warning that the "context" parameter is unused. If I
insert:
context = NULL;
to supress that will that potentially impact performace? With GCC I know
you can do:
const void *
idx_byte(const void *p, int idx, void * __attribute__ ((unused)) context)
{
return (unsigned char *)p + idx;
}
I'm not sure which is uglier but is there a standard method for handling
this?
Also, this function is a member of a structure possibly supplied by the
caller so making it 'inline' will have no impact right? Is there a way
to improve the performance of this function?
Thanks,
Mike
parameters? I have a function that might be called hundreds of thousands
of times that looks like this:
const void *
idx_byte(const void *p, int idx, void *context)
{
return (unsigned char *)p + idx;
}
This generates a warning that the "context" parameter is unused. If I
insert:
context = NULL;
to supress that will that potentially impact performace? With GCC I know
you can do:
const void *
idx_byte(const void *p, int idx, void * __attribute__ ((unused)) context)
{
return (unsigned char *)p + idx;
}
I'm not sure which is uglier but is there a standard method for handling
this?
Also, this function is a member of a structure possibly supplied by the
caller so making it 'inline' will have no impact right? Is there a way
to improve the performance of this function?
Thanks,
Mike