Solaris 7 64-bit Developer's Guide

Specify Type of Constants

A loss of data can occur in some constant expressions because of lack of precision. These types of problems are very hard to find. Be explicit about specifying the type(s) in your constant expressions. Add some combination of {u,U,l,L} to the end of each integer constant to specify its type. You might also use casts to specify the type of a constant expression.


Example 4-9

int i = 32;
long j = 1 << i;		/* j will get 0 because RHS is integer */
                    	/* expression */

Suggested use:


int i = 32;
long j = 1L << i;