Re: Cast abuse



On 2001.11.20 13:49 Jules Bean wrote:
> Disagree.  What's the point of an unnecessary cast.

Some people argue that it provides more readable code. With poorly named 
variables, a cast is used to remind one of the type of variable one is 
dealing with. Of course this is done at the expense of robustness, as it's 
unavoidable to disable some error checking by casting.
I, personally, use casts on mallof and free for portability reasons, some 
of my code needs to compile under SCO OSR3.2 and OSR5. Malloc and free take 
and return char * there...
Outside of that, I try to avoid them, or place them so that it's clear to 
see why it's there and what I'm doing.

Melanie



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]