Re: Question
- From: Max <invalid@xxxxxxxxxxxxxxx>
- Date: Thu, 12 Jun 2008 00:45:20 +0200 (CEST)
On 11 Jun 2008 21:23:46 GMT, richard@xxxxxxxxxxxxxxx (Richard Tobin) wrote:
In article <1292858.4WXqv0htDk@xxxxxxxx>, Max <invalid@xxxxxxxxxxxxxxx> wrote:
Can I ask C questions here?
I don't know. Why not give it a try and see if you're up to it?
If I compile this function
unsigned short div(unsigned short a, unsigned short b)
{
return a / b;
}
with warnings turned on, I am informed that
Warning test.c: 3 Assignment of int to unsigned short. Possible loss of precision
Warning test.c: 4 Assignment of int to unsigned short. Possible loss of precision
Warning test.c: 4 Assignment of int to unsigned short. Possible loss of precision
(line 3 is the line with the return statement, line 4
is the line with the closing brace)
(1) What does that mean, specifically, what is precision
in this context?
(2) How do I get rid of them? I tried all sorts of casts,
unsuccessfully. In a program with lots of such functions,
real problems can easily get lost, but I don't want to
disable warnings.
.
- Follow-Ups:
- Re: Question
- From: pete
- Re: Question
- From: Richard Heathfield
- Re: Question
- From: Ben Bacarisse
- Re: Question
- From: Walter Roberson
- Re: Question
- References:
- Question
- From: Max
- Re: Question
- From: Richard Tobin
- Question
- Prev by Date: Re: Question
- Next by Date: Re: average true range
- Previous by thread: Re: Question
- Next by thread: Re: Question
- Index(es):
Relevant Pages
|