Variable names

Post your requests and ideas on the future development of mikroBasic PRO for PIC.
Post Reply
Author
Message
ilferrari
Posts: 195
Joined: 18 Nov 2013 09:09

Variable names

#1 Post by ilferrari » 01 Jul 2014 08:21

The compiler claims lots of commonly-used variable names, such as

Identifier "a" has been already declared in "P18F26J50.mbas"
Identifier "c" has been already declared in "P18F26J50.mbas"
Identifier "p" has been already declared in "P18F26J50.mbas"
Identifier "s" has been already declared in "P18F26J50.mbas"
Identifier "p1" has been already declared in "P18F26J50.mbas"
Identifier "s1" has been already declared in "P18F26J50.mbas"
Identifier "b1" has been already declared in "P18F26J50.mbas"

The compiler should leave these to the developer.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Variable names

#2 Post by filip » 25 Jul 2014 08:42

Hi,

These identifiers are declared in the definition file of the MCU and user should modify the code in respect to that.

Regards,
Filip.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Variable names

#3 Post by janni » 25 Jul 2014 15:53

ilferrari wrote:The compiler claims lots of commonly-used variable names, such as...
It's Microchip that uses these names for specific registers/bits of a processor, not the compiler. You're free to rename them (if you intend to use only your own libraries, that is :wink: ).

Note that 8-bit processors are not computers with operating system separating programmer from hardware. One has to use processor resources directly, and as best (and only) information about specific processor is contained in it's datasheet, it makes sense to use the original naming defined therein.

In one detail you are right, though. The b0..b7 names are needed only in mC where one cannot use simple numbers to designate bits. In mB and mP it made little sense to introduce them, but mE probably wanted to have processor definitions in all compilers alike.

On the other hand, good programming practice discourages use of simple, one or two letter names (except for indices, perhaps) - after all text editors nowadays are not limited by small memory :) .

Post Reply

Return to “mikroBasic PRO for PIC Wish List”