Friday 10 February 2012

OPERATOR PRECEDENCE


Java has well-defined rules for specifying the order in which the operators in an expression are evaluated when the expression has several operators.
Precedence Order: When two operators share an operand the operator with the higher precedence goes first.
Associativity: When two operators with the same precendence the expression is evaluated according to its associativity. That is associativity of an operator is a property that determines how operators of the same precedence are grouped.
The table below shows all Java operators from highest to lowest precedence, along with their associativity.

Operator
Description
Associativity
[]
.
()
++
--
access array element
access object member
invoke a method
post-increment
post-decrement
left to right
++
--
+
-
!
~
pre-increment
pre-decrement
unary plus
unary minus
logical NOT
bitwise NOT
right to left
()
new
cast
object creation
right to left
*
/
%
multiplicative
left to right
+ -
+
additive
string concatenation
left to right
<< >>
>>>
shift
left to right
<  <=
 >=   >
instanceof
Relational

Type comparision
left to right
==
!=
Equality
left to right
&
bitwise AND
left to right
^
bitwise XOR
left to right
|
bitwise OR
left to right
&&
conditional AND
left to right
||
conditional OR
left to right
?:
conditional
right to left
==  +=  -=
*=  /=
%=
&=  ^=
>>=  <<=
>>>=
assignment
Right to left

Order of evaluation: In Java, the left operand is always evaluated before the right operand. Also applies to function arguments.
Short circuiting: When using the conditional AND and OR operators (&& and ||), Java does not evaluate the second operand unless the first argument does not suffice to determine the value of expression. 

Monday 6 February 2012

cc OPTIONS


SYNTAX:

Option
cc <option>

Description

-c
Compiles only; does not attempt to link
 source files.
-D name[=value]
Is passed to C compiler to assign the
 indicated value to the symbol name 
when the C preprocessor is run.
-f float
Specifies the floating point options that 
the compiler and linker use. The following
 should be supported:
-f -  - no floating point required
-f
 - emulated floating point
-fp
 hardware floating point 
(using 80x87 coprocessor)
-Idir
Search dir for included files whose names
 do not begin with a slash (/) prior to 
searching the usual directories. The
 directories for multiple -I options are
 searched in the order specified.
 The preprocessor first searches for 
#include files in the directory 
containing sourcefile, and then in
 directories named with -I options
 (if any), then /usr/ucbinclude,
 and finally, in /usr/include.
-Ldir
Add dir to the list of directories
 searched for libraries by 
 /usr/ccs/bin/ucbcc. This option is
 passed to /usr/ccs/bin/ld and /usr/lib.
 Directories specified with this option 
are searched before /usr/ucblib 
and /usr/lib.
-l library
If linking, adds the indicated library to
 the list of libraries to be linked.
-M
If linking, creates a map file with the 
same base name as the output 
executable, but with the suffix.map. This
 map file contains a list of symbols with
 their addresses.
-m model
Specifies the memory model that the 
compiler and linker use. The models
 may include:
-ms
small model
-mm
medium model
-ml
large model
-mf
flat model (32-bit)
-mc
compact model
-mh
huge model
-o output
If linking, places the executable output
 in the file output.
-S
Produces assembler listing with source
 code.
-Uname
Is passed to the C compiler, to undefined
 the symbol name.
-Y P, dir
Change the default directory used for
 finding libraries.


Labels