User forums > General (but related to Code::Blocks)
cast and static cast
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. :?
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
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?
--- End quote ---
Not sure that there is another way. But may be one of my colleagues could have used something different/better. I will inquire :).
--- End quote ---
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
Navigation
[0] Message Index
[*] Previous page
Go to full version