Click here to Skip to main content
15,889,403 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: SetDate Pin
Bernhard Hiller26-Apr-12 22:02
Bernhard Hiller26-Apr-12 22:02 
GeneralRe: SetDate Pin
loctrice27-Apr-12 1:53
professionalloctrice27-Apr-12 1:53 
GeneralRe: SetDate Pin
R. Giskard Reventlov27-Apr-12 12:39
R. Giskard Reventlov27-Apr-12 12:39 
GeneralThats why i hate c++ Pin
Vasily Tserekh24-Apr-12 3:35
Vasily Tserekh24-Apr-12 3:35 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh24-Apr-12 3:43
Vasily Tserekh24-Apr-12 3:43 
GeneralRe: Thats why i hate c++ PinPopular
glennPattonWork327-Apr-12 0:18
professionalglennPattonWork327-Apr-12 0:18 
GeneralRe: Thats why i hate c++ Pin
Member 376360827-Apr-12 7:48
Member 376360827-Apr-12 7:48 
GeneralRe: Thats why i hate c++ Pin
StephenPhillips29-Apr-12 0:28
StephenPhillips29-Apr-12 0:28 
It's just as well you've had an error like this - hopefully if/when you fix it, you'll have a more structured method for debugging in the future. It is not a good idea to write code with the approach of build and run it hoping it works; you have no idea what could be going wrong under the surface.

If I was faced with an empty error dialog, I think my approach would be as follows (Apologies in advance, I'm not familiar with C++ Builder 6)

- Track down 'when' the error occurs. We know it happens as you open the program, so try building some more useful output into the program. It sounds like you're unable to debug line-by-line, so I'd try bringing up an output dialog each time something works properly - print some useful text to say what was done, etc.

- Find the offending operation/function that is causing the issue. With the information you've provided, I'd keep an eye out for any file loading stuff that may be involved; perhaps your file loader can only handle absolute paths and it's being fed relative ones.

- Replace the suspect code with a simple test - instead of trying to load a file, perhaps output a "Loading file [path+filename]" message. If it doesn't come up with the blank dialog anymore, you know which line causes the issue. I'm far more used to debugging by pressing F10 until it breaks in Visual Studio, so this is effectively a more long-winded approach to doing the same thing.

- Fix the offending code. Naturally, you still need to be able to load the file; I'm unfamiliar with your program's requirements, but if it's plain C++ loading a data file (binary or text, usually) then you should have no problems using an input stream[^]. I can promise you that this definitely works, and won't give you blank error messages.


If you find errors in your code, it shouldn't matter if you get nonsensical or unhelpful messages - that's often the flavour of the day when it comes to programming. You need to break it down into each step to find out what's wrong, which inherently helps you understand your own code (or other people's code) better.

Happy hunting!
Sometimes a fist in the face says more than a thousand honeyed words.

GeneralRe: Thats why i hate c++ Pin
Keith.Badeau29-Apr-12 6:25
Keith.Badeau29-Apr-12 6:25 
GeneralRe: Thats why i hate c++ Pin
jeron124-Apr-12 6:38
jeron124-Apr-12 6:38 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh24-Apr-12 8:20
Vasily Tserekh24-Apr-12 8:20 
GeneralRe: Thats why i hate c++ Pin
Chris Meech24-Apr-12 9:09
Chris Meech24-Apr-12 9:09 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh24-Apr-12 10:06
Vasily Tserekh24-Apr-12 10:06 
GeneralRe: Thats why i hate c++ PinPopular
CDP180224-Apr-12 10:48
CDP180224-Apr-12 10:48 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh24-Apr-12 14:16
Vasily Tserekh24-Apr-12 14:16 
GeneralRe: Thats why i hate c++ Pin
Mohibur Rashid24-Apr-12 17:27
professionalMohibur Rashid24-Apr-12 17:27 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh25-Apr-12 2:48
Vasily Tserekh25-Apr-12 2:48 
GeneralRe: Thats why i hate c++ PinPopular
CDP180225-Apr-12 3:46
CDP180225-Apr-12 3:46 
GeneralRe: Thats why i hate c++ Pin
Gary Huck27-Apr-12 3:38
Gary Huck27-Apr-12 3:38 
GeneralRe: Thats why i hate c++ PinPopular
exegetor27-Apr-12 4:06
exegetor27-Apr-12 4:06 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh27-Apr-12 5:10
Vasily Tserekh27-Apr-12 5:10 
GeneralRe: Thats why i hate c++ Pin
SlingBlade27-Apr-12 14:01
SlingBlade27-Apr-12 14:01 
GeneralRe: Thats why i hate c++ Pin
Vasily Tserekh27-Apr-12 7:05
Vasily Tserekh27-Apr-12 7:05 
GeneralRe: Thats why i hate c++ Pin
Bacchus Beale2-May-12 19:38
Bacchus Beale2-May-12 19:38 
GeneralRe: Thats why i hate c++ PinPopular
BobJanova25-Apr-12 4:18
BobJanova25-Apr-12 4:18 

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.