Go to Post As Grandma used to say, "empirical data is better than no data at all." - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 16-03-2005, 20:35
DarkAlex DarkAlex is offline
Registered User
#0365 (MOE)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Delaware
Posts: 6
DarkAlex is on a distinguished road
Send a message via AIM to DarkAlex
Printf Oddity : Programming Challange

Here is a challange for the FIRST programming community. I promise a super-tremendous prize, like a candy bar, at nationals to whoever figures it out.

The Challange:
Recently, aka for nobody knows how long but recently found, we have had a problem with our autonomous program where we have vital print statements. If we remove certain printf statments, now named vital, our program stops printing anything out and tries to run backwards through the closest wall. We don't really know how long it has been in the code, because we normally left the 'vital' print statements in anyway just because they were useful. However, we were running out of code space and trying to cut down on memory usage and we took one out and discovered this problem.
We did some experimentation and discovered that it didn't matter what the vital print statements printed, but they had to print something. Integer, just "Nothing," it didn't matter. The spots where the vital print statements had to be were seemingly random places in our code, at the very beginning, when we move through our 3D data structure. We managed to eliminate the need for one print statement by correcting a small error in our data structure, but the other one remained. We tried almost everything, moving statements around, adding them at odd places, nothing eliminated the need for the statement.
At first we suspected a syntax error somewhere that the print statement was, somehow, correcting. No luck. Then we thought of stdio. It didn't matter whether we included it or not or where. Again no luck. Ok, at this point we'd pretty much accepted our odd print statement as a permenate part of our code that we're just going to have to deal with. It was something we worked on in our free time. Not that we had that much time, but it bugged us enough to occupy all we had.
Eventually I randomly removed the initialization printf statement in User Initialization in User Routines (that is included in the default code) and suddenly our code worked. No other print statements were required anymore to stop it from trying to kill us.
I don't understand. Does anyone understand? This doesn't make logical sense that the initialization printf statement would require a second statement to stop it from destroying our program. Keep in mind that we have not edited that statement at all since we got the default code. We have had various programmers proofread our code. No one has found any odd syntax error or statement re-declaration.

Summary:
1) Without some vital printf("..."); statements our program does not work
2) With some vital printf("..."); we start at nearly the right place in our data structure, but one step too far
3) When we remove all but the vital printf statements our program works perfectly
4) When we remove ALL the print statements in our seperate autonomous file, and also remove the default initialization statement our program works perfectly.
5) We use 3 Interrupts. I'm not sure this is significant, but I always suspect interrupts.

Here is the question that must be answered: Why?

Feel request other information.
__________________
You must first die if you would be reborn.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
Organizing a programming team. scitobor 617 Programming 7 28-01-2005 19:18
Default Code and printf WilsonDJ00 Programming 2 22-01-2005 16:39
Robot Programming Education phrontist Programming 11 03-05-2004 07:32
Anyone with a replacement Printf? Larry Barello Programming 5 19-03-2004 02:20


All times are GMT -5. The time now is 00:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi