[Info-vax] yet another sys$qiow question
JF Mezei
jfmezei.spamnot at vaxination.ca
Sat Aug 22 00:29:03 EDT 2015
I think I understand the volatile issue.
However, since the IOSB is a structure, pedandically speaking, wouldn't
the compiler treat each member of the structure independantly ?
aka: reading the first member repeatedly might cause it to be optimized
to register (or optimized away), but even if it has happened, reading
the second member of structure would cause a memory fetch of the second
value. Right ?
What about character buffers ?
Say I put 0x00 as first byte of a 250 byte char buffer. Call QIO to read
data into buffer, and then loop until the first byte of buffer is no
longer 0 (I know, even worse practice than looing to check IOSB :-)
Would the compiler also optimize this loop away, even if it is character
data ?
>From a programmer's point of view, if I were to test for
strlen(buffer) != 0
How do I know as a programmer whether "strlen" will be considered an
external routine (which will impart "volatile" on buffer), or a known
routine which the compiler will inline code, and then optimize because
it knows that strlen won't modify buffer so the whole thing can be
optimized away ?
If I declare buffr as "volatile", it is correct to state that I no
longer have to worry about whether a routine is external or inline code
since buffer will always be assumed it could change ?
More information about the Info-vax
mailing list