Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C pointers

Name: Anonymous 2011-12-05 20:36

/prog/ i have a problem.

I have an array of structs -> 400 in size and i do basic shit with them:


loop i:=0 -> 7^3
  Let s = struct @ i
  loop j:=0 -> 7^3 | j != i
    EditInnerStructValues(s,struct @ j);
//7^3 as in 7 to the 3rd power


This works for i:=0->16 THEN at i:=16 struct @ 242 changes it's pointer value to 0xFF800000 and this lasts till j:=19 at which point the pointer value then changes to 0xFFC00000.

I've checked my code over and over again and I've found no conclusion as to why it's doing this. If i change the length of the array to 6^3 or less it works fine. Anything >=7^3 lengths error out at a certain value with the same issue as described above.

Does /prog/ have any idea why this might be occuring?

Name: Anonymous 2011-12-05 20:46

>>2
No, I've also tried the looping without

EditInnerStructValues(s,struct @ j);


but I don't see how anything could be screwing up the pointers in there (especially when pointer #262 is not sent in there when it supposedly is changed)



void EditInnerStructValues(a,b){
  assert(a);
  assert(b);
  float
    dx = b->x - a->x,
    dy = b->y - a->y,
    d  = sqrt(dx*dx + dy*dy);
  float f;
  d = d * d;
  f = 5/d;
  a->xx = (f*dx)/d;
  a->yy = (f*dy)/d;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List