SW500010 Microchip Technology, SW500010 Datasheet - Page 93

HI-TECH C PRO FOR PIC10/12/16

SW500010

Manufacturer Part Number
SW500010
Description
HI-TECH C PRO FOR PIC10/12/16
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC10/12/16r
Datasheets

Specifications of SW500010

Supported Families
PIC10, PIC12, PIC16
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC10/12/16
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC10, PIC12, PIC14, PIC16, PIC16E
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
019P
778-1006
778-1006
C Language Features
The midrange PIC devices have larger stacks and are thus allow a higher degree of function nesting.
These devices do not use the lookup table method when calling functions.
compiler inserts the appropriate instructions to ensure this is true if required. Any functions callable
from C code that are written in assembler must also ensure that bank zero is selected before the
return.
3.7 Operators
HI-TECH C supports all the ANSI operators. The exact results of some of these are implementation
defined. The following sections illustrate code produced by the compiler.
3.7.1 Integral Promotion
When there is more than one operand to an operator, they typically must be of exactly the same type.
The compiler will automatically convert the operands, if necessary, so they have the same type. The
conversion is to a “larger” type so there is no loss of information. Even if the operands have the same
type, in some situations they are converted to a different type before the operation. This conversion
is called integral promotion. HI-TECH C performs these integral promotions where required. If you
are not aware that these changes of type have taken place, the results of some expressions are not
what would normally be expected.
rieties of char, short int or bit-field types to either signed int or unsigned int. If the
result of the conversion can be represented by an signed int, then that is the destination type,
otherwise the conversion is to unsigned int.
if(a - b < 10)
count++;
converted to signed int via integral promotion before the subtraction takes place. The result of
the subtraction with these data types is -50 (which is less than 10) and hence the body of the if()
statement is executed. If the result of the subtraction is to be an unsigned quantity, then apply a
cast. For example:
count++;
would not be executed.
The compiler assumes that bank zero will be selected after returning from any function call. The
Integral promotion is the implicit conversion of enumerated types, signed or unsigned va-
Consider the following example.
unsigned char count, a=0, b=50;
The unsigned char result of a - b is 206 (which is not less than 10), but both a and b are
if((unsigned int)(a - b) < 10)
The comparison is then done using unsigned int, in this case, and the body of the if()
Operators
93

Related parts for SW500010