lkml.org 
[lkml]   [1997]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Style question: comparison between signed and unsigned?

On Wed, 24 Sep 1997, Mike Jagdis wrote:

> On Wed, 24 Sep 1997 brianh@risky.bit3.com wrote:
>
> > Um, how is this worse then having tons of implicit and undocumented
> > typecasts hidden throughout the code?
>
> Implicit type casts follow strict rules. Once people start explicitly
> type casting *everything* you have to assume they knew what they
> were doing - and got it right.

You need to make the same assumption with implicit type casts ("Did he
really mean to convert a float into a char?" - I _have_ seen that as an
implicit cast!)- except now you have no gaurentee that the programmer was
even aware they were converting to a new type.

> We all know that there are those of us (you?) who can get it right
> and that the majority can't be trusted. I want to stand a chance
> of QA'ing that code...

Try Pascal. Pascal does wonders for protecting stupid programmers from
stupid mistakes. It also prevents intelligent programmers from breaking
the rules when they need too, but hey. You give programmers the ability
to break the rules, and some morons will when they don't need to.

And Linux- any language which allows:
void (*f)(int *) = (void (*)(int *)) 3;
int * p = (int *) 3;
(*f)(p);
To be valid code has things a lot more dangerous than simple typecasting.

>
> Mike

"NT and security should never be used in the same breath."
- Winn Schwartau, EETimes #972, 22 September 1997 pp.96

-Brian

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.029 / U:1.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site