Shop OBEX P1 Docs P2 Docs Learn Events
Location of CON,VAR, OBJ — Parallax Forums

Location of CON,VAR, OBJ

bdickensbdickens Posts: 110
edited 2010-10-12 07:34 in Propeller 1
As I write the code, I dutifully put all my CON, VAR, and OBJ statements together. I've noticed in some other folks code that they have CON blocks all through the code. Does it make a difference ?

I've always assumed that the compiler wouldn't want multiple blocks but it seems to be fine. It would make the code more readable if the CON and VAR blocks were close to the routines that really used them the most. But I don't want to sub-optimize memory.

Under what circumstances does it matter ?

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-12 07:21
    It doesn't matter.

    You can have multiple CON, VAR, and OBJ sections. The VARs are all grouped together and the variables are sorted by the compiler so that the LONGs come first, then the WORDs, then the BYTEs in order to avoid waste from alignment issues.
  • bdickensbdickens Posts: 110
    edited 2010-10-12 07:34
    Thanks. That does make life somewhat clearer.
Sign In or Register to comment.