Author Topic: cast and static cast  (Read 11424 times)

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: cast and static cast
« Reply #15 on: December 11, 2005, 12:04:52 pm »
Well you've described my situation exactly and since I also have to maintain some code in work besides writing my own, I really can't deside how to act when seeing this kind of casts as they seem to me perfectly legitimate, on the other hand I like keeping my own copy of the buffer to play around with it.  :?
Life would be so much easier if we could just look at the source code.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: cast and static cast
« Reply #16 on: December 11, 2005, 09:10:00 pm »
Yes, I think that in such cases casts could be seen as legitimate (if the needed precautions are taken) and I do not see for the moment a better solution. Keeping a copy of the buffer could be useful for different reasons, but if available memory is a constraint, then keeping a copy of the buffer would be not a so good idea.

Michael

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: cast and static cast
« Reply #17 on: December 14, 2005, 12:02:07 pm »

Or do you let's say memcpy from the buffer to a new object of every needed struct? Or is there another way?

Not sure that there is another way. But may be one of my colleagues could have used something different/better. I will inquire :).

After inquiring :), none of my colleagues seems to have a better solution and therefore cast is used. Anyway, they also advice to use some precautions, e.g., the code should be good commented.

Michael