<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: &amp;quot;Odd&amp;quot; DEC C Compiler Behaviour, or &amp;quot;vaguely expected&amp;quot;? (OVMS/VAX v6.2, DEC C in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058827#M104753</link>
    <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; And, speaking of bit fields...&lt;/P&gt;&lt;P&gt;&amp;gt; result = sys$setimr(0, bintim1, timer_function, 0, 0) ;&lt;BR /&gt;&amp;gt; printf("\nResult of $SETIMR #1=%d", result) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "%d"?&amp;nbsp; A VMS status code, which actually has bit fields, would be a&lt;BR /&gt;good place for a format like, say, "%%x%08x".&lt;/P&gt;</description>
    <pubDate>Fri, 16 Aug 2019 03:09:53 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2019-08-16T03:09:53Z</dc:date>
    <item>
      <title>"Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C v5.5-002)</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058749#M104750</link>
      <description>&lt;P&gt;I made some code changes to add new functionality that would alert us to someone resting a heavy object on a VT terminal on the shop floor (the process normally only reads a manual-override serial number, and when input is received from the VT, it causes a $CANCEL to be issued for any in-flight communications with the PLC;&amp;nbsp; leaving a heavy object on the VT keyboard causes all communications with the PLC to stop working until the object is removed).&lt;/P&gt;&lt;P&gt;The change involved detecting excessive input within a threshold time period, then generating an OPCOM message to suitable-enabled terminals and generation of an email message.&lt;BR /&gt;&lt;BR /&gt;After this, it would enter a guard/backoff period where a $QIO to read from the terminal would not be issued ($SETIMR to set a timer to expire after the guard period, then the AST service routine would clear a flag that an outer level routine relied on, reset the count of input from the terminal, then call $WAKE so that the outer level routine would carry on after the $HIBER that it issued).&lt;BR /&gt;&lt;BR /&gt;I found that the process was remaining in a $HIBER state, and I thought that perhaps the delta timer I specified was incorrect (extracting a per-process user-configurable value, using $BINTIM to convert, checking if it is an absolute/delta time, then using LIB$SUB_TIMES to compare it against minimum &amp;amp; maximum values, and doing the same again for a system-wide value if a per-process value isn't specified).&lt;BR /&gt;&lt;BR /&gt;I eventually determined that no timer was being set in the first place, and it all came down to the way that the parameters for $SETIMR were passed (and not checking the return status as there was no expectation that the values passed to it were invalid).&lt;BR /&gt;&lt;BR /&gt;The call to $SETIMR was in the following form:&lt;BR /&gt;SYS$SETIMR(0, &lt;EM&gt;delta_time_variable&lt;/EM&gt;, &lt;EM&gt;ast_service_routine&lt;/EM&gt;, 0, 0) ;&lt;BR /&gt;&lt;BR /&gt;When I did eventually check the return status, it was 12 decimal - SS$_ACCVIO&lt;BR /&gt;&lt;BR /&gt;I looked at other code that I knew worked (because I have seen those timers been set to wait whilst an SS$_ABORT or SS$_HANGUP has occurred, to prevent the process thrashing in an infinite I/O loop when the target port or server of the LAT port is not reachable or set to Access: Remote), and I couldn't understand how it was working.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;A comparison of the CC /LIST /MACHINE_CODE=INTERSPERSED between the two revealed a difference, and some time later I realised that the bigger difference was how the quadword was defined.&lt;BR /&gt;&lt;BR /&gt;In the working code, it was stored as unsigned int &lt;EM&gt;delta_time_variable&lt;/EM&gt;[2], whereas in non-working code, it was this:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;typedef struct quadword_struct&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;unsigned long int hi_part ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;unsigned long int lo_part ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;} QUADWORD ;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;QUADWORD &lt;EM&gt;delta_time_variable&lt;/EM&gt;&amp;nbsp;;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A small reproducer (TEST.C) follows:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#include &amp;lt;descrip&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;#include &amp;lt;stdio&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;#include &amp;lt;starlet&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;typedef struct quadword_struct&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;unsigned long int hi_part ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;unsigned long int lo_part ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;} QUADWORD ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;void timer_function(void) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;int main(int argc, char *argv[])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;int result ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;unsigned long int bintim1[2] ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;QUADWORD bintim2 ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;$DESCRIPTOR(delta_desc, "0 00:05:00.00") ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;/*&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Forward declaration of system services in starlet are&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in lower case; use upper case here and get a&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %CC-I-IMPLICITFUNC informational on compilation...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;sys$bintim(&amp;amp;delta_desc, &amp;amp;bintim1) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;sys$bintim(&amp;amp;delta_desc, &amp;amp;bintim2) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;result = sys$setimr(0, bintim1, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;printf("\nResult of $SETIMR #1=%d", result) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;result = sys$setimr(0, bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;printf("\nResult of $SETIMR #2=%d", result) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;result = sys$setimr(0, &amp;amp;bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;printf("\nResult of $SETIMR #3=%d", result) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;return (1) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;void timer_function(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;printf("\nTimer has expired") ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;BR /&gt;&lt;BR /&gt;$ CC TEST.C /LIST /MACHINE=INTER&lt;BR /&gt;$ LINK TEST.OBJ&lt;BR /&gt;$ RUN TEST&lt;BR /&gt;&lt;BR /&gt;Result of $SETIMR #1=1&lt;BR /&gt;Result of $SETIMR #2=12&lt;BR /&gt;Result of $SETIMR #3=1&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="trebuchet ms,geneva" size="3"&gt;Extrapolating the Macro-32 for the $SETIMR calls from the .LIS file:&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;result = sys$setimr(0, bintim1, timer_function, 0, 0) ;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7E 7C 00B4 clrq -(sp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp;58 00000000* EF DE 00B6 moval TIMER_FUNCTION,r8&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 58 DD 00BD pushl r8&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F0 AD 9F 00BF pushab -16(fp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 00 DD 00C2 pushl #0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp;57 00000000* EF DE 00C4 moval SYS$SETIMR,r7&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;67 05 FB 00CB calls #5,(r7)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;result = sys$setimr(0, bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7E 7C 00DE clrq -(sp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 58 DD 00E0 pushl r8&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5E 08 C2 00E2 subl2 #8,sp&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;6E E8 AD 08 28 00E5 movc3 #8,-24(fp),(sp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 00 DD 00EA pushl #0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;67 06 FB 00EC calls #6,(r7)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;result = sys$setimr(0, &amp;amp;bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7E 7C 00F8 clrq -(sp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 58 DD 00FA pushl r8&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;E8 AD 9F 00FC pushab -24(fp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 00 DD 00FF pushl #0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;67 05 FB 0101 calls #5,(r7)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I generally strive to avoid Macro-32 where possible (other than writing some code to jump over other instructions and use PATCH to modify an executable, it's been "some time" since I last used Macro-32 / Macro-11, and even then I wasn't regularly programming in it).&lt;BR /&gt;&lt;BR /&gt;So, my Macro-32 might be a little rusty, but the P1/first argument to the generated CALLS instruction appears to be the number of arguments, and in the failing $SETIMR call, the C compiler has added an &lt;STRONG&gt;&lt;EM&gt;extra&lt;/EM&gt;&lt;/STRONG&gt; parameter beyond that accepted by $SETIMR (though I suspect it is the SUBL2 or MOVC3 that helps trigger the SS$_ACCVIO when an attempt is made to dereference the address placed on the stack).&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;Is it just me, or does this behaviour seem odd (yes, I know, you get what you deserve if you don't test return status and don't prefix the variable name with the ampersand)?&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;On a related note, when I was writing the code, I had got it into my head from somewhere that the top bit of the quadword would indicate whether or not a time was a delta time (the docs say that delta times are negative, but it seems that the top longword is set to %XFFFFFFFF, which is what I'm checking to see if the user-configurable threshold &amp;amp; backoff time values are absolute (after all, don't want to set a timer that expires in 10 years'time)).&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;Is there a pictorial explanation of the bit fields of a quadword time somewhere? (I have looked in the programming concepts manuals, and a scanned (non-searchable) copy of the IDS book, and nothing readily stands out)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;Or perhaps an alternative way of determining if a binary quadword time is a delta time beyond comparing the high word with FFFFFFFF?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 20:55:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058749#M104750</guid>
      <dc:creator>Mark_Corcoran</dc:creator>
      <dc:date>2019-08-14T20:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: "Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058779#M104751</link>
      <description>&lt;P&gt;&amp;gt; [...] does this behaviour seem odd [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I've managed to avoid even looking at VAX Macro for decades.&lt;/P&gt;&lt;P&gt;&amp;gt; [...] I had got it into my head from somewhere that the top bit of the&lt;BR /&gt;&amp;gt; quadword would indicate whether or not a time was a delta time [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Perhaps from the HELP?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [...] The daytim argument is the 64-&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bit address (on Alpha and Integrity server systems) of a quadword&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time value. A positive time value specifies an absolute time&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at which the timer expires; a negative time value specifies an&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; offset (delta time) from the current time.&lt;/P&gt;&lt;P&gt;&amp;gt; [...] it seems that the top longword is set to %XFFFFFFFF, [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "seems"?&amp;nbsp; "top longword"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf( "\n bt2.hi = 0x%08x, bt2.lo = 0x%08x.\n",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bintim2.hi_part, bintim2.lo_part);&lt;/P&gt;&lt;P&gt;&amp;nbsp;bt2.hi = 0x4d2fa200, bt2.lo = 0xffffffff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; These systems are little-endian, you know.&amp;nbsp; I'd expect the "lo" part&lt;BR /&gt;to come first.&lt;/P&gt;&lt;P&gt;&amp;gt; Is there a pictorial explanation of the bit fields of a quadword time&lt;BR /&gt;&amp;gt; somewhere? [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "bit fields"?&amp;nbsp; What's to picture?&amp;nbsp; It's the number of ticks of some&lt;BR /&gt;size (100ns?) since some epoch or other, isn't it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="https://en.wikipedia.org/wiki/OpenVMS#Timekeeping" target="_blank"&gt;https://en.wikipedia.org/wiki/OpenVMS#Timekeeping&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; [...] comparing the high word with FFFFFFFF?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I'd look at the sign bit, not all 32 bits.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 06:32:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058779#M104751</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2019-08-15T06:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: "Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058791#M104752</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier" size="2"&gt;daytim&lt;/FONT&gt; argument is quadword, read only, by (64-bit) reference. As the MACRO32 code shows, &lt;FONT face="courier new,courier" size="2"&gt;bintim1&lt;/FONT&gt; is passed as address (&lt;FONT face="courier new,courier" size="2"&gt;pushab -16(fp)&lt;/FONT&gt;), where &lt;FONT face="courier new,courier" size="2"&gt;bintim2&lt;/FONT&gt; is passed as quadword (&lt;FONT face="courier new,courier" size="2"&gt;movc3 #8,-24(fp),(sp)&lt;/FONT&gt;). Simply said, you have to use "&lt;FONT face="courier new,courier" size="2"&gt;sys$setimr(0, &amp;amp;bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;"&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:08:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058791#M104752</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2019-08-15T13:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: "Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058827#M104753</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; And, speaking of bit fields...&lt;/P&gt;&lt;P&gt;&amp;gt; result = sys$setimr(0, bintim1, timer_function, 0, 0) ;&lt;BR /&gt;&amp;gt; printf("\nResult of $SETIMR #1=%d", result) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "%d"?&amp;nbsp; A VMS status code, which actually has bit fields, would be a&lt;BR /&gt;good place for a format like, say, "%%x%08x".&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 03:09:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7058827#M104753</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2019-08-16T03:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: "Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7059471#M104754</link>
      <description>&lt;P&gt;&amp;gt;&lt;SPAN&gt;Simply said, you have to use "&lt;/SPAN&gt;&lt;FONT face="courier new,courier" size="2"&gt;sys$setimr(0, &amp;amp;bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;Indeed.&amp;nbsp; The post was more concerned with the compiler specifying a parameter count that exceeded the number of parameters that $SETIMR accepts.&lt;BR /&gt;&lt;BR /&gt;After increasing the number of longwords in the QUADWORD structure to 3, the compiler increased the parameter count to 2 more than the maximum number of parameters accepted by $SETIMR.&lt;BR /&gt;&lt;BR /&gt;I see what it's doing, though I don't necessarily agree with that part of its behaviour when the ampersand is omitted.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 08:00:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7059471#M104754</guid>
      <dc:creator>Mark_Corcoran</dc:creator>
      <dc:date>2019-08-22T08:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: "Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7059472#M104755</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt; [...] it seems that the top longword is set to %XFFFFFFFF, [...]&lt;BR /&gt;&amp;gt; "seems"?&lt;/P&gt;&lt;P&gt;&amp;gt; "top longword"?&lt;/P&gt;&lt;P&gt;&amp;gt;"bit fields"? What's to picture?&lt;/P&gt;&lt;P&gt;This is not Usenet in the early 1990s, I'm not posting from AOL.COM, and I'm not a NOOB that hasn't undertaken any research before posting my query.&lt;/P&gt;&lt;P&gt;There are a number of posts to this forum by one-time posters, who are often new to OpenVMS (as a result of development/coding being outsourced &amp;amp; offshored).&lt;/P&gt;&lt;P&gt;They often do themselves no favours by not adequately describing the background, context, versions of software, commands issued or exact error messages received.&lt;/P&gt;&lt;P&gt;You frequently respond to them in the same truculent/sardonic/snide manner.&lt;/P&gt;&lt;P&gt;Do you really feel that this is acceptable behaviour in a public electronic forum? Or the workplace?&lt;BR /&gt;&lt;BR /&gt;Prospective employers and customers (in the context of offering consulting services) can and do search out postings to social media &amp;amp; other forums before making decisions, so aside from putting off the thinner-skinned posters and lurkers, you're likely not doing yourself any favours.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; [...] it seems that the top longword is set to %XFFFFFFFF, [...]&lt;BR /&gt;&amp;gt; "seems"?&lt;BR /&gt;Given that I hadn't performed a $BINTIM for all ~86.4bn delta time values (and then examined the resulting quadword value), I didn't consider it acceptable to state that it is &lt;EM&gt;always&lt;/EM&gt; set to FFFFFFFF.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; "top longword"?&lt;BR /&gt;Because I had (wrongly) effectively assumed Big-Endian (because I had long since forgotten; maybe your memory is perfect - mine, alas, is not).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;And, speaking of bit fields...&lt;BR /&gt;&amp;gt;"%d"? A VMS status code, which actually has bit fields, would be a good place for a format like, say, "%%x%08x".&lt;BR /&gt;&amp;gt;&amp;gt;A small reproducer (TEST.C) follows:&lt;BR /&gt;Let me rephrase. A small reproducer created solely for the purpose of exhibiting the problem, not an excerpt which is extracted from the actual production code.&lt;/P&gt;&lt;P&gt;For the purposes of the test reproducer, having the returned condition value displayed in decimal or hexadecimal is neither here nor there:&lt;/P&gt;&lt;P&gt;$ EXIT 12&lt;BR /&gt;%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000C, PC=0000000C, PSL=00000000&lt;/P&gt;&lt;P&gt;$ EXIT %X0000000C&lt;BR /&gt;%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000C, PC=0000000C, PSL=00000000&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Consequently, in the context of the test reproducer, I really don't care about the control bits, the facility number bits, the message number bits, or the severity bits.&lt;/P&gt;&lt;P&gt;In actual production code, I do however tend to output it as an 8-character hexadecimal string with a %X prefix.&lt;/P&gt;&lt;P&gt;But thank you for taking the time to critique.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 08:03:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7059472#M104755</guid>
      <dc:creator>Mark_Corcoran</dc:creator>
      <dc:date>2019-08-22T08:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: "Odd" DEC C Compiler Behaviour, or "vaguely expected"? (OVMS/VAX v6.2, DEC C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7059505#M104758</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/1809391"&gt;@Mark_Corcoran&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&amp;gt;&lt;SPAN&gt;Simply said, you have to use "&lt;/SPAN&gt;&lt;FONT face="courier new,courier" size="2"&gt;sys$setimr(0, &amp;amp;bintim2, timer_function, 0, 0) ;&lt;/FONT&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;Indeed.&amp;nbsp; The post was more concerned with the compiler specifying a parameter count that exceeded the number of parameters that $SETIMR accepts.&lt;BR /&gt;&lt;BR /&gt;After increasing the number of longwords in the QUADWORD structure to 3, the compiler increased the parameter count to 2 more than the maximum number of parameters accepted by $SETIMR.&lt;BR /&gt;&lt;BR /&gt;I see what it's doing, though I don't necessarily agree with that part of its behaviour when the ampersand is omitted.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;That's the way how structures are passed by value.&lt;/P&gt;&lt;P&gt;And it is an effect of having/using no real prototypes. In a current &lt;FONT face="courier new,courier"&gt;starlet.h&lt;/FONT&gt; (unless &lt;FONT face="courier new,courier"&gt;__NEW_STARLET&lt;/FONT&gt; is defined) there is &lt;FONT face="courier new,courier"&gt;int sys$setimr(__unknown_params);&lt;/FONT&gt; where &lt;FONT face="courier new,courier"&gt;__unknown_params&lt;/FONT&gt; is "&lt;FONT face="courier new,courier"&gt;#define&lt;/FONT&gt;"d as nothing. Whether you can define/use the new starlet feature in your environment, I don't know. If it is defined, in a current environment you will see &lt;FONT face="courier new,courier"&gt;%CC-E-NOCONVERT, In this statement, "bintim2" is of type "struct quadword_struct", and cannot be converted to "long pointer to struct &lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;_generic_64". &lt;/FONT&gt;along with other warnings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 10:18:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/quot-odd-quot-dec-c-compiler-behaviour-or-quot-vaguely-expected/m-p/7059505#M104758</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2019-08-22T10:18:25Z</dc:date>
    </item>
  </channel>
</rss>

