- why use static_cast ? - 5 Updates
| JiiPee <kerrttuPoistaTama11@gmail.com>: Oct 20 08:14PM +0300 On 20/10/2022 19:07, Scott Lurndal wrote: > I would argue against this viewpoint, myself. I mean, using static_cast is not slowing down a program in about 99.9% of cases against not using it. Talking about the slowness of static cast here. But of course I would not put a static cast in a tight loop looping millions of things a second. |
| scott@slp53.sl.home (Scott Lurndal): Oct 20 05:30PM >of cases against not using it. Talking about the slowness of static cast >here. But of course I would not put a static cast in a tight loop >looping millions of things a second. static_cast is an annotation. It should not cause any significant differences in the generated code. dynamic_cast, on the other hand, will at a minimum add a lookup to the typeinfo. |
| JiiPee <kerrttuPoistaTama11@gmail.com>: Oct 20 08:41PM +0300 On 20/10/2022 20:30, Scott Lurndal wrote: > static_cast is an annotation. It should not cause any significant > differences in the generated code. dynamic_cast, on the other > hand, will at a minimum add a lookup to the typeinfo. sorry mistake, I meant dynamic_cast. But the code I have been doing and seen, I rarely see a place where dynamic cast would slow down signifantly. Because many of the loops are looping something maybe 20-100 times so it does not slow down significantly there. |
| Lynn McGuire <lynnmcguire5@gmail.com>: Oct 20 01:21PM -0500 On 10/20/2022 8:55 AM, Scott Lurndal wrote: >> character*8. longint is a long long. > Young C++ programmers don't understand C, so they think > that static_cast<fem::str<8>*> is more "readable". Heh. The programmer in question is 39 and has been writing C and C++ since he was 13 or 14. His actual comment was that static_cast's are easier to grep which I find hard to believe. Thanks, Lynn |
| Lynn McGuire <lynnmcguire5@gmail.com>: Oct 20 01:21PM -0500 On 10/19/2022 9:01 PM, Lynn McGuire wrote: > character*8. longint is a long long. > Thanks, > Lynn Thanks to all for the views ! They were good. Lynn |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment