Validity of cast(void*)size_t.max

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 6 11:57:55 UTC 2018


On 3/6/18 1:08 AM, Kagamin wrote:
> On Monday, 5 March 2018 at 18:28:43 UTC, Steven Schveighoffer wrote:
>> Note, I think the error is bogus, you should be able to create 
>> hard-coded addresses of data at compile time -- I'm not sure how you 
>> would do hardware registers otherwise.
> 
> I'd do them as extern variables, it wouldn't be nice to have them as 
> pointers.
> extern int reg1;
> And use linker option to define address: --defsym reg1=0x1111

I hadn't thought of that. It's probably a better solution than pointers.

However, I would expect D to have a proper way to do this without 
resorting to linker tricks.

-Steve


More information about the Digitalmars-d-learn mailing list