[lvm-devel] const correctness, first cut

Petr Rockai prockai at redhat.com
Mon Aug 6 21:02:57 UTC 2007


>>>  		process_each_lv_in_vg(cmd, vg, NULL, NULL, NULL,
>>> -				      &lvdisplay_full);
>>> +				      (process_single_lv_fn_t)lvdisplay_full);
>>
>> Is there a nice way to avoid those casts?
>
> This is where you wish for features of other languages.
>
> I wrote an earlier iteration that instead added a new function,
> process_each_lv_in_vg_ro (read-only), with the appropriate
> signature for the fn-parameter, but IMHO, that was worse,
> and besides, wasn't worth it, for just one use.

You could still add a new function that just confines the ugly cast?
(Assuming that's not what you have done). Maybe _const instead of _ro,
too.

Yours, Peter.

-- 
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation




More information about the lvm-devel mailing list