Shop OBEX P1 Docs P2 Docs Learn Events
Order loading vars — Parallax Forums

Order loading vars

T ChapT Chap Posts: 4,223
edited 2009-05-25 04:41 in Propeller 1
While working on a big program, I started getting strange crashes and behavior that didn't make sense. The program was compiling somewhere around 7500. I started cleaning things up and getting rid of unused declared vars, shrinking some stack space and got the program running fine. I also organized the declared vars in the order:

Long arrays and stack space

Longs

Word arrays

Words

Byte arrays

Bytes.

I am not sure this type of organization offers any benefit actually, but thought I had read about organizing declarations from largest to smallest somewhere before.

Has anyone heard of such an order of declared vars being of any benefit? My goal is to avoid problems as the program gets larger. So I am looking for optimization tricks.

Post Edited (TChapman) : 5/25/2009 4:29:29 AM GMT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-25 04:38
    The compiler will reorder VARs to all longs, then all words, then all bytes; but withinn a given class, the order will be whatever you specify in your program.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-25 04:41
    The compiler already sorts longs first, then words, then bytes in order to minimize misalignment memory waste.
Sign In or Register to comment.