Apparently unsigned types really are necessary

Marco Leise Marco.Leise at gmx.de
Sun Jan 22 01:31:17 PST 2012


Am 22.01.2012, 08:23 Uhr, schrieb bcs <bcs at example.com>:

> On 01/21/2012 10:05 PM, Walter Bright wrote:
>> http://news.ycombinator.com/item?id=3495283
>>
>> and getting rid of unsigned types is not the solution to signed/unsigned
>> issues.
>
> A quote from that link:
>
> "There are many use cases for data types that behave like pure bit  
> strings with no concept of sign."
>
> Why not recast the concept of unsigned integers as "bit vectors (that  
> happen to implement arithmetic)"? I've seen several sources claim that  
> uint (and friends) should never be used unless you are using it for low  
> level bit tricks and the like.

Those are heretics.

> Rename them bits{8,16,32,64} and make the current names aliases.

So everyone uses int, and we get messages like: "This program currently  
uses -1404024 bytes of RAM". I have strong feelings against using signed  
types for variables that are ever going to only hold positive numbers,  
especially when it comes to sizes and lengths.


More information about the Digitalmars-d mailing list