Click here to Skip to main content
15,891,529 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.

 
GeneralClassical unitialized C pointer Pin
Jochen Arndt20-Jan-12 0:59
professionalJochen Arndt20-Jan-12 0:59 
GeneralRe: Classical unitialized C pointer Pin
Albert Holguin23-Jan-12 4:52
professionalAlbert Holguin23-Jan-12 4:52 
JokeRe: Classical unitialized C pointer Pin
cpkilekofp27-Jan-12 6:35
cpkilekofp27-Jan-12 6:35 
GeneralRe: Classical unitialized C pointer Pin
ii_noname_ii24-Jan-12 3:42
ii_noname_ii24-Jan-12 3:42 
GeneralRe: Classical unitialized C pointer Pin
cpkilekofp27-Jan-12 6:48
cpkilekofp27-Jan-12 6:48 
GeneralRe: Classical unitialized C pointer Pin
Stefan_Lang25-Jan-12 4:44
Stefan_Lang25-Jan-12 4:44 
GeneralRe: Classical unitialized C pointer Pin
Jochen Arndt25-Jan-12 5:51
professionalJochen Arndt25-Jan-12 5:51 
GeneralRe: Classical unitialized C pointer Pin
cpkilekofp27-Jan-12 6:51
cpkilekofp27-Jan-12 6:51 
Stefan_Lang wrote:
Woot, they wondered for decades and never demanded a fix? OMG | :OMG: Can I have your users
please?? Blush | :O


Can't fix it unless you can find it, and an uninitialized pointer can often be found to be pointing at something that looks like valid memory (say, some other string's buffer that isn't getting used at the moment) so the error doesn't occur all the time. Errors like this become "cold cases" because there are so few clues to follow. I sort of doubt that the users were quiet about it, either.

Pertinent to but opposing a point made by someone's tag line I read today, this is why I always initialize as close to the definition as possible, just to keep in the habit - I work in environments that assume initialization as well as environments like C where assumptions make asses out of everyone.
GeneralRe: Classical unitialized C pointer Pin
Stefan_Lang29-Jan-12 22:16
Stefan_Lang29-Jan-12 22:16 
GeneralRe: Classical unitialized C pointer Pin
MarvinMartian28-Jan-12 11:50
MarvinMartian28-Jan-12 11:50 
GeneralRe: Classical unitialized C pointer Pin
YvesDaoust29-Jan-12 21:01
YvesDaoust29-Jan-12 21:01 
GeneralRe: Classical unitialized C pointer Pin
Jochen Arndt29-Jan-12 21:32
professionalJochen Arndt29-Jan-12 21:32 
GeneralRe: Classical unitialized C pointer Pin
YvesDaoust29-Jan-12 23:02
YvesDaoust29-Jan-12 23:02 
GeneralRe: Classical unitialized C pointer Pin
Jochen Arndt29-Jan-12 23:10
professionalJochen Arndt29-Jan-12 23:10 
GeneralRe: Classical unitialized C pointer Pin
YvesDaoust29-Jan-12 23:27
YvesDaoust29-Jan-12 23:27 
GeneralRe: Classical unitialized C pointer Pin
Jochen Arndt29-Jan-12 23:52
professionalJochen Arndt29-Jan-12 23:52 
GeneralRe: Classical unitialized C pointer Pin
YvesDaoust30-Jan-12 0:10
YvesDaoust30-Jan-12 0:10 
GeneralRe: Classical unitialized C pointer Pin
Jochen Arndt30-Jan-12 0:24
professionalJochen Arndt30-Jan-12 0:24 
GeneralRe: Classical unitialized C pointer Pin
YvesDaoust30-Jan-12 0:37
YvesDaoust30-Jan-12 0:37 
GeneralRe: Classical unitialized C pointer Pin
Jochen Arndt30-Jan-12 1:12
professionalJochen Arndt30-Jan-12 1:12 
GeneralCode Optimize Pin
Rajesh Anuhya16-Jan-12 3:06
professionalRajesh Anuhya16-Jan-12 3:06 
GeneralRe: Code Optimize PinPopular
BobJanova16-Jan-12 3:40
BobJanova16-Jan-12 3:40 
GeneralRe: Code Optimize Pin
Florin Jurcovici16-Jan-12 22:02
Florin Jurcovici16-Jan-12 22:02 
GeneralRe: Code Optimize Pin
BobJanova16-Jan-12 22:46
BobJanova16-Jan-12 22:46 
GeneralRe: Code Optimize Pin
James Lonero17-Jan-12 17:14
James Lonero17-Jan-12 17:14 

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.