'int' is enough for 'length' to migrate code from x86 to x64

via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 27 02:31:02 PST 2014


On Thursday, 27 November 2014 at 08:31:24 UTC, Kagamin wrote:
> I don't think there's such clear separation that can be 
> expressed in a type, it's more in used coding practices rather 
> than type. You can't change coding practice by introducing a 
> new type.

You need to separate and define the old types as well as 
introducing a clean way to do low level manipulation. How to do 
the latter is not as clear, but…

…regular types should be constrained to convey the intent of the 
programmer. The intent is conveyed to the compiler and to readers 
of the source-code. So the type definition should be strict on 
whether the intent is to convey monotonic qualities or 
circular/modular qualities.

The C-practice of casting from void* to char* to float to uint to 
int in order to do bit manipulation leads to badly structured 
code. Intrinsics also leads to less readable code. There's got to 
be a better solution to keep "bit hacks" separate from regular 
code. Maybe a register type that maps onto SIMD registers…


More information about the Digitalmars-d mailing list