Question about cast



In page 81 of N1124 in footnote 87 we read:

If the value of the expression is represented
with greater precision or range than required
by the type named by the cast (6.3.1.8), then
the cast specifies a conversion even if the type
of the expression is the same as the named type.

Can someone give me an example of what this means ?

Otherwise the relevant section hardly says anything about
the semantics of cast. Assume for example that on some
machine unsigned int is 32 bits and unsigned char is 8
bits. If i is unsigned int what is the value of
(unsigned char) i ? Is it the same as 255 & i but of type
unsigned char as opposed to unsigned int ?

Spiros Bousbouras

.



Relevant Pages

  • mplayerplug-in for FC4 x86_64
    ... Compiling from source isn't going much ... Source/plugin.cpp:593: error: cast from 'void*' to 'unsigned int' loses ...
    (Fedora)
  • Re: unpacking ints
    ... You need to cast the individual bytes to unsigned int ... >> first and cast the total result to int only after the number is constructed. ... I assumed that anybody working at the bytelevel uses unsigned char ... Karl Heinz Buchegger ...
    (comp.lang.cpp)
  • Re: Question about cast
    ... the cast specifies a conversion even if the type ... machine unsigned int is 32 bits and unsigned char is 8 ... If noone here knows do you think it is worthwhile to ...
    (comp.lang.c)
  • Re: Question about cast
    ... the cast specifies a conversion even if the type ... machine unsigned int is 32 bits and unsigned char is 8 ... A cast is simply an operator that specifies a conversion. ... document belongs in comp.std.c; discussion of the language it defines ...
    (comp.lang.c)
  • Re: size of a struct
    ... "an unsigned integer" might not be an unsigned int. ... So in C99 we would have to cast it to unsigned long long? ... If your runtime library is C99 compliant (which it might not be even ...
    (comp.lang.c)