News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

cast and static cast

Started by Michael, December 09, 2005, 04:42:45 PM

Previous topic - Next topic

yop

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.

Michael

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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Michael

Quote from: Michael on December 11, 2005, 01:30:55 AM

Quote from: yop on December 11, 2005, 12:22:27 AM
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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]