Is the underscore accepted for all identifiers, even for lower case names?
Is it accepted for module names and module filenames?
underscore usage
-
- Site Admin
- Posts: 525
- Joined: Fri Dec 31, 2010 12:30 pm
- Contact:
Re: underscore usage
Underscore is accepted anywhere that a letter (uppercase or lowercase) is accepted. There are no arbitrary restrictions imposed by the compiler on its use. However, be aware that it is an Astrobe extension to Oberon and is not recommended for general use. The usual Oberon programming convention is to use camel caps to distinguish words in identifiers that are compound words (e.g. SlaveReadTxNoAck instead of slavereadtxnoack or slave_read_tx_no_ack).
Underscore was introduced in Astrobe specifically to allow the naming of MCU constants in the source code to be consistent with the names used in the manufacturer's reference manuals e.g. IOCON_PIO1_10.
If you are intending to share your code with others or port it to other Oberon systems (e.g. RISC5 FPGA) you should restrict the use of underscores in other scenarios to a minimum. Needless to say, if you are going to be the only person who ever sees your code then you can use them wherever you like
Underscore was introduced in Astrobe specifically to allow the naming of MCU constants in the source code to be consistent with the names used in the manufacturer's reference manuals e.g. IOCON_PIO1_10.
If you are intending to share your code with others or port it to other Oberon systems (e.g. RISC5 FPGA) you should restrict the use of underscores in other scenarios to a minimum. Needless to say, if you are going to be the only person who ever sees your code then you can use them wherever you like
Re: underscore usage
that's good. must module names be always equal to their filenames (excluded the extension)?
is there a mandatory extension or in principle any reasonable extension could be used? some systems use .obn other .mod and so on...
is there a mandatory extension or in principle any reasonable extension could be used? some systems use .obn other .mod and so on...
-
- Site Admin
- Posts: 525
- Joined: Fri Dec 31, 2010 12:30 pm
- Contact:
Re: underscore usage
When using Astrobe for ARM Cortex-M targets the files containing Oberon source code should be named <modulename>.mod
The names of the generated files (object, symbol, executable files etc.) are formed from the <modulename> + an extension (.obj, .sym, .bin etc.)
The IDE, compiler and linker use these naming conventions when looking for files to open, import and link.
For more details refer to Chapter 2 File Descriptions in one of the three documents Oberon for Cortex-M Microcontrollers which you can download from Astrobe - The Oberon Programming Language webpage.
The names of the generated files (object, symbol, executable files etc.) are formed from the <modulename> + an extension (.obj, .sym, .bin etc.)
The IDE, compiler and linker use these naming conventions when looking for files to open, import and link.
For more details refer to Chapter 2 File Descriptions in one of the three documents Oberon for Cortex-M Microcontrollers which you can download from Astrobe - The Oberon Programming Language webpage.