Compiler seems to refuse to execute a single line of code (TDateTime related?)

This is how my code looks (the second method has been simplified significantly in my attempt to solve this problem myself):

procedure TPrintClippingLabels.PopulateDates(
  ASearchInfo: TKey);
  iI:        integer;
  aDateList: TClippingLabelDateList;
  //  Fill in the dateComboBox with dates corresponding to the chosen media
  aDateList := TConnection.GetInstance.GetClippingLabelDates(ASearchInfo);

  {Make an improvised index of mediaID/Date so the date can be retrieved in
  TDateTime format}
  SetLength(aRegistrations, High(aDateList) + 1);
  for iI := Low(aDateList) to High(aDateList) do begin
    with aRegistrations[iI] do begin
      MediaID := ASearchInfo;
      RegistrationDate := ADateList[iI];

and where my little improvised index is used:

procedure TPrintClippingLabels.UpdateAmount(AMedia: TKey;
  ADate: string);
  iI: integer;
  dTrueDate: TDateTime;
  sDateConversionHolder: string;
  bMediaAlike: boolean;
  bDateAlike: boolean;
  //  Update FUI.lblAmount with the correct amount of labels to be printed

  // Find the TDateTime corresponding to the string retrieved from the GUI
  for iI := Low(aRegistrations) to High(aRegistrations) do

    dTrueDate := aRegistrations[iI].RegistrationDate;



and here are the type definitions of the custom datatypes:

  TClippingLabelInfoList = array of TClippingLabelInfo;
  TKey = type integer;
  TRegistration = record  //  aRegistrations is a unit-wide variable of this type
    MediaID: TKey;
    RegistrationDate: TDateTime;

The idea is that I store list of ID's (integer) and  TDateTimes in aDateList so that, when the date has been presented to the user and he's chosen a single date (it has been passed through the DateTimeToString procedure to make it presentable in a combobox), I can compare the stored values of aDateList (also passed through DateTiemToString) to the text coming from the ComboBox of the GUI and thereby ascertain which TDateTime that corresponds to the text passed from the GUI.

Now my problem is, when I'm stepping through my program the line dTrueDate := aRegistrations[iI].RegistrationDate; is not executed! The compiler seems to just skip the line, no eror message or anything! I've tried everything I could think of at least twice, to no avail and I'm about ready to start breaking stuff!

I hope this is enough of the code for you guys to help me, otherwise just ask and I'll post whatever you need!

By the way I'm using Delphi 5 pro on a windows XP pro machine.

Any help would be greatly appreciated!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It is skip because of optimization.
It is local variable not used anywhere.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You should either make it global or use in assignment ( as right argument) or as a procedure call argument.

The same is for example with a procedure which is not called anywhere in the program.
The code for such a procedure is not generated at all.

Notice that there is no blue dot on left margin in an editor pane for these lines of code.
XenixAuthor Commented:
Annoying as it is to have spend so much time trying to solve a problem that wasn't REALLY there, you are right!

As soon as I ignored the problem and continued with my code the problem solved itself, aparently I had no clue as to how the compiler does optimization.
Not that I would do it when the program is to be compiled finally, but there is an option somewhere in the IDE to switch off optimization, right?
XenixAuthor Commented:
Oh, and by the way, thanks so much for your help!

You saved both windows and furniture in my apartment :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.