Re: Does Casting Slow a Program Down?




"santosh" <santosh.k83@xxxxxxxxx> wrote in message
news:1170256067.706720.20060@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Quality of code generation is implementation defined. A good optimiser
might be able to figure out that usLimit is not changed and hence, use
a single, cached value. On some hardware, short and int might be of
the same size and representation. In such cases, the cast never takes
up any object code. But speed of execution is not specified by the
standard and no guarantees are made. An assignent statement that takes
ten days to complete is perfectly legal, as per the standard, as long
as all the side effects are resolved before the next sequence point.


I find the general question which (I think) hes asking interesting.

Can integer casts generate extra instructions?
How about floating point casts?


.



Relevant Pages

  • Re: Is there a library function for placing cursor position in the cosole?
    ... That's a Windoze problem (in other words, it isn't meeting the standard ... > void printat(Win *win, int x, int y, char ch) ... even more to certain hardware and operating systems. ... many graphics libraries there are, ...
    (comp.lang.c)
  • Re: Reading a large number of text files into an array
    ... > convert this string into an array of doubles? ... > int main ... the array dependent on the maximum length of all components from which the ... No need for either of the casts here. ...
    (comp.lang.c)
  • Re: out
    ... The above code before I added the int casts just by a gut feeling didn't ... By adding the int casts in front of the NULLs what have I really done? ... The casts are likely to silence some error messages, ... electrical tape over the warning lights on the dashboard; ...
    (comp.lang.c)
  • Re: linux-next: Tree for April 10 (arch/x86)
    ... It is an undefined behaviour according to any variant of C standard. ... we would kill the absolute majority of casts - ... bogus warnings also reduce the psychological ... that looks senseless then why not circumvent _other_ warnings that look ...
    (Linux-Kernel)
  • Re: Problems With strtof()
    ... > int main ... i.e. invoking gcc with the additional ... While the casts here don't ... Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org ...
    (comp.lang.c)