volatile struct definition for peripheral control registers

Josh Holtrop jholtrop at gmail.com
Tue Dec 3 00:08:07 UTC 2024


On Monday, 2 December 2024 at 22:44:24 UTC, Ali Çehreli wrote:
> On 12/2/24 12:27 PM, Josh Holtrop wrote:
>
> >>   alias get this;
> >
> > If I use `alias this` I don't know how I can get
> `volatileLoad()` to be
> > called.
>
> Note that alias this is used with your 'get' function, which 
> still calls volatileLoad().
>
> Ali

Ah... very nice. I completely missed that "alias this" could be 
used with a function.

This works great and lets me use a nicer syntax to declare the 
fields.

Thank you both. :)


More information about the Digitalmars-d-learn mailing list