March 06, 2018 Re: Validity of cast(void*)size_t.max | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | 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
|
Copyright © 1999-2021 by the D Language Foundation