Click here to Skip to main content
15,903,388 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: if bool Pin
Jörgen Sigvardsson15-Mar-07 13:17
Jörgen Sigvardsson15-Mar-07 13:17 
GeneralRe: if bool Pin
Bradml12-Mar-07 23:12
Bradml12-Mar-07 23:12 
GeneralRe: if bool Pin
Ed.Poore13-Mar-07 0:12
Ed.Poore13-Mar-07 0:12 
Generalthe hard way Pin
Shog910-Mar-07 8:47
sitebuilderShog910-Mar-07 8:47 
GeneralRe: the hard way Pin
Dmitry Khudorozhkov12-Mar-07 6:01
Dmitry Khudorozhkov12-Mar-07 6:01 
GeneralRe: the hard way Pin
Shog912-Mar-07 11:11
sitebuilderShog912-Mar-07 11:11 
GeneralRe: the hard way Pin
Dmitry Khudorozhkov12-Mar-07 11:18
Dmitry Khudorozhkov12-Mar-07 11:18 
GeneralRe: the hard way Pin
Shog912-Mar-07 13:56
sitebuilderShog912-Mar-07 13:56 
Well, in this case, the side-effects are hidden: logically, the const methods act const, as they never modify data that can be seen from the outside. A nicer solution would have been to solve the performance issues by re-writing other components, but that would have greatly expanded the scope of this change. Another potential strategy would have been to pre-cache everything, but that would have improved the (unlikely) worst-case scenarios at the expense of the much more common scenarios.

That said, i still cringe whenever i see a const_cast (or C-cast used as a const_cast), and am very happy i was able to remove them.



----
...the wind blows over it and it is gone, and its place remembers it no more...

GeneralRe: the hard way Pin
Dmitry Khudorozhkov13-Mar-07 5:58
Dmitry Khudorozhkov13-Mar-07 5:58 
GeneralRe: the hard way Pin
Shog913-Mar-07 6:32
sitebuilderShog913-Mar-07 6:32 
GeneralRe: the hard way Pin
Dmitry Khudorozhkov13-Mar-07 6:38
Dmitry Khudorozhkov13-Mar-07 6:38 
GeneralRe: the hard way Pin
Shog913-Mar-07 6:57
sitebuilderShog913-Mar-07 6:57 
GeneralRe: the hard way Pin
Dmitry Khudorozhkov13-Mar-07 7:03
Dmitry Khudorozhkov13-Mar-07 7:03 
GeneralRe: the hard way Pin
Shog913-Mar-07 7:13
sitebuilderShog913-Mar-07 7:13 
GeneralRe: the hard way Pin
Roger Bamforth12-Mar-07 6:04
Roger Bamforth12-Mar-07 6:04 
GeneralRe: the hard way Pin
Rob Caldecott13-Mar-07 5:13
Rob Caldecott13-Mar-07 5:13 
GeneralRe: the hard way Pin
Shog913-Mar-07 11:58
sitebuilderShog913-Mar-07 11:58 
GeneralOracle stored procs Pin
User 5838528-Mar-07 14:34
User 5838528-Mar-07 14:34 
GeneralRe: Oracle stored procs Pin
PIEBALDconsult8-Mar-07 15:39
mvePIEBALDconsult8-Mar-07 15:39 
GeneralYou cannot have it! Pin
Rajesh R Subramanian8-Mar-07 0:59
professionalRajesh R Subramanian8-Mar-07 0:59 
GeneralRe: You cannot have it! Pin
Bradml8-Mar-07 1:04
Bradml8-Mar-07 1:04 
GeneralRe: You cannot have it! Pin
Rajesh R Subramanian8-Mar-07 1:07
professionalRajesh R Subramanian8-Mar-07 1:07 
GeneralRe: You cannot have it! Pin
Thomas Stockwell9-Mar-07 13:33
professionalThomas Stockwell9-Mar-07 13:33 
GeneralRe: You cannot have it! Pin
Gizz8-Mar-07 2:22
Gizz8-Mar-07 2:22 
JokeRe: You cannot have it! Pin
Nemanja Trifunovic8-Mar-07 3:42
Nemanja Trifunovic8-Mar-07 3:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.