INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

TList - Corrupted Data Problem

TList - Corrupted Data Problem

(OP)
I'm using a TList with some specific records and I'm running into a problem (TD2006). What I'm putting into it is something like this:

CODE

Myrecord = record
  A: String[255];
  B: String[255];
  C: String[50];
  D: String[50];
  E: Extended;
end; 

But when I get it out, I get messed up data in E, resulting in a floating-point exception. Now I tried tracing it through my code and noticed that E wasn't getting overwritten BEFORE I added the record, and even proved that by overwriting it with a uniform character before I started processing it. The curious part to me is that I can move E to any other position in the record and have it work absolutely properly with no indications that any data got corrupted at any point. When D is in the final position, I notice no data corruption whatsoever in that value.

I've run out of all the things I know to look for in my code (something overwriting the data beyond it's bounds, namely). Any thoughts on things to look at (as obviously there's something wrong somewhere if E in that position is getting corrupted)?

RE: TList - Corrupted Data Problem

(OP)
OK hammered on this a while and figured it out. Still no explanation for why, but here goes. I had this in an interface, so ended up pulling the class out and testing it. Works perfectly. So guess what I did to finally get it to work smoothly (at least so far)?

CODE

Myrecord = packed record
  A: String[255];
  B: String[255];
  C: String[50];
  D: String[50];
  E: Extended;
end; 

Riddle me that, did that and the interface itself worked perfectly from thereon (as far as I could tell). So....why is this?

RE: TList - Corrupted Data Problem

Maybe explained here.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close