DIP62: Volatile type qualifier for unoptimizable variables in embedded programming
Johannes Pfau via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 17 12:54:18 PDT 2014
Am Thu, 17 Jul 2014 11:43:04 -0700
schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
> On 7/17/14, 9:06 AM, John Colvin wrote:
> > On Thursday, 17 July 2014 at 15:58:05 UTC, Andrei Alexandrescu
> > wrote:
> >> I think an approach based on functions peek/poke is a lot more
> >> promising. D programs must define sequences of std calls anyway,
> >> otherwise even the simplest programs that use writeln("What's your
> >> name?") followed by a readln() are incorrect. So in a way peek/poke
> >> come for "free".
> >
> > Could you expand on this "sequences of calls"? What exactly do you
> > mean by defining it?
>
> For example if you run this C program:
>
> printf("ur name: ");
> fflush(stdout);
> scanf("%s", &name);
> printf("Hello, %s!", name);
>
> it's guaranteed the order of calls is preserved.
Function calls are actually compiler barriers in every C (like)
compiler, I guess that's even in the standard. Relying on this too
much can be dangerous with inlining though.
Back to topic: Thanks for your response, so let's go with peek/poke /
volatileLoad/Store then.
More information about the Digitalmars-d
mailing list