Miscellaneous Questions

This section deals with questions that have turned up on the newsgroup and should be documented somewhere. In the interest of completeness, issues will just be tacked onto the end of this list. Later, as time permits, they may be reorganized into other sections.

Unsigned Integers

How can I ask Sather to use unsigned longs instead of a regular old INT? (Cliff Draper)

Check out the INT class. There are operations for unsigned calculations. If you use them it should work fine, but you cannot use syntactic sugar anymore (instead of a+b you'll have to write a.uplus(b) ). You could also define a new value class UINT that uses INT, something like

        value class UINT is
           v:INT;
	   create(int_value: INT): SAME is return v(u); end;
           plus(k:UINT):UINT is
              r:UINT;
              r.v(v.uplus(k.v));
              return r;
           end;
	   a: UINT := #(1);
Note that literals will need to be explicitly converted from INT to UINT during the create, as shown for the variable ``a''. Courtesy Claudio Fleiner.

Benedict A. Gomes
Mon Apr 29 10:12:43 PDT 1996