User Tools

Site Tools


preventing_20structure_20member_20names_20being_20crunched

Preventing structure member names being crunched

by Richard Russell, March 2010

By default structure member names are crunched on compilation (assuming the Abbreviate names option is selected), just like the names of ordinary variables, arrays etc. Normally this is perfectly OK, and is what you will want to reduce the size of the executable and make it run more quickly.

However there is one situation when you don't want structure member names to be altered, which is when the structure is referenced both in your main program and in a library but only one of them has been crunched (or they have been crunched independently). If the crunch process alters the member names in the library but not in the main program (or vice versa), the program may not run.

There are two main circumstances when this situation might arise:

  • The Crunch embedded program files compiler option has not been selected. In this case the main program will be crunched but the libraries won't be. You might need to deselect this option if one or more library files or other embedded program modules are not compatible with crunching.


  • The library has been supplied 'pre crunched' by its author. Even if your main program is also crunched, structure member names probably won't agree with those in the library because they were crunched independently.


In these circumstances you will need to prevent crunching of the structure member names taking place. There are four main ways to achieve this:

  • Give the structure members names which correspond to the static integer variables (i.e. A% to Z%). Although the members aren't really static variables, the cruncher will leave their names unaltered. Obviously this is suitable only for integer members.


  • Give the structure members numeric names, i.e. consisting entirely of digits (e.g. 1& or 23$). Although ordinary variable names cannot start with a digit, structure member names can.


  • Give the structure members names starting with the @ character (e.g. @a& or @b$). Ordinary variable names cannot start with the @ character, because it is reserved for system variables, but structure member names can, and they won't be abbreviated.


  • Include the structure member names in a REM!Keep compiler directive. Although this is normally used to prevent crunching of regular variable, array and structure names, it will also be effective with structure member names.


Ideally this issue should be avoided entirely by not referencing the members of a structure in both the main program and in a library (for example by using an 'opaque' structure whose members are referenced only in the library) but that may not always be possible or desirable.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
preventing_20structure_20member_20names_20being_20crunched.txt · Last modified: 2024/01/05 00:21 by 127.0.0.1