Identifiers (Names), Case Sensitivity

Top  Previous  Next

Identifiers and case sensitivity

There is no direct limitation of the maximum identifier ("name") length.

Identifiers may include letters (A-Z, a-z), digits (0-9) and the following special characters: _ ~ $ .

Identifiers must not start with a digit and must not contain any spaces.

 

Tibbo BASIC compiler is case insensitive. ABC, abc, and Abc refer to the same identifier. This is in line with the BASIC tradition.

Tibbo C compiler is case sensitive. ABC, abc, and Abc are three different identifiers. This is in accordance with the ANSI C standard.

The linker is case insensitive, it sees everything in lowercase. To the linker, ABC, abc, and Abc refer to the same identifier abc.

The parser is case-sensitive both in Tibbo BASIC and Tibbo C. Even within a BASIC file, the parser will assume that ABC and abc as two separate entities.

 

In practical terms, case sensitivity of C and case insensitivity of the linker means that in C...

... You can define local variables X and x (in the same local scope) without any problem.
... You cannot define global variables Y and y or functions FUNC() and func() — this won't work because of the linker.

 

Recommended identifier and constant styles

Basing on the above, I recommend you to avoid using the "CamelCase" style in identifiers. The style preferred by Tibbo is my_counter_1, not MyCounter1.

For constants we use all-uppercase names such as CONST_MAX_COUNTER.

The system will work well for pure BASIC, pure C, and BASIC+C projects.

 

I also propose that you do not start variable and procedure names with on_. This prefix is reserved for event handlers.

For example, on_sys_init is the event handler for the ON_SYS_INIT event of the system (sys.) object.