Signed vs Unsigned Operators

"Elliot H. Mednick" <>
Thu, 2 Jul 1992 01:04:41 GMT

          From comp.compilers

Related articles
Signed vs Unsigned Operators (Elliot H. Mednick) (1992-07-02)
Re: Signed vs Unsigned Operators (1992-07-02)
| List of all articles for this month |

Newsgroups: comp.compilers
From: "Elliot H. Mednick" <>
Organization: Wellspring Solutions
Date: Thu, 2 Jul 1992 01:04:41 GMT
Keywords: arithmetic, design

I am looking for references to languages where the operator, not the
operands, determines if the operation should be signed or unsigned. The

I am on the committee that oversees the langauge content of the Verilog
Hardware Description Language. I am investigating a number of proposed
enhancements; one in particular deals with signed vs unsigned arithmetic.

In Verilog, there is a data type, called REG, that is unsigned (since it
maps to real hardware registers). Therefore, arithmetic operations on
that type are unsigned as well (i.e. multiplication, division, right
shift, etc.). It has been proposed that signed arithmetic be allowed on
the REG data type.

In most high-level, strongly-typed, languages, signed arithmetic is
handled by using a signed data type. In Verilog, this does not make
sense, since a REG is an abstract storage element. Therefore, I have
proposed adding signed operators, much like ISPS [Bell, Newell, Siewiorek,
Barbacci 1982] or assembler. ISPS uses a verbose syntax to "overload" the
operator (a two-letter modifier inside curly braces: X = Y + {sm} Z)
                                                                                                eg. sign/magnitude

I am looking for a precedent for using a more terse, but aesthetic, symbol
set for the set of operators whose meaning changes with signed
(specifically, two's compliment) arithmetic: *, /, %, >>, etc. I think
that using a two-character combination is the way to go, such as ~*, ~/,
~&, ~>, etc.

Are there any obscure (or not-so-obscure) languages that allow explicit
determination between signed and unsigned arithmetic?

Thanks in advance.

Elliot H. Mednick P.O. Box 150
Wellspring Solutions Sutton, MA. 01590 +1 508 865 7271

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.