<div dir="ltr"><div><div><div><div><div>Hi Volker,<br><br></div>I will accept your challenge.<br></div>My correct solution offered below makes two assumptions:<br></div>a) The programming language is c++<br></div>b) The program below does what I want it to do, I wonder if that was what you intended? :-)<br><br></div>Richard Jones<br><br><span style="font-family:monospace,monospace">#include <stdint.h><br>#include <stdio.h><br>static const uint16_t setting = 15*60;<br>class values {<br>  uint8_t a, b, c;<br>  uint32_t d;<br>  uint8_t e;<br>  uint16_t f;<br>  values();<br>};<br>values::values() {<br>  a=50;<br>  b= 1;<br>  c=10;<br>  d=0xFFB070;<br>  e= 5;<br>  f=0x03FF;<br>};<br>void func() {<br>  uint32_t ms;<br>  ms = setting * 1000;<br>  // ...<br>}<br><br></span><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 23, 2016 at 3:34 PM, Volker Kuhlmann <span dir="ltr"><<a href="mailto:list0570@paradise.net.nz" target="_blank">list0570@paradise.net.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is for AVR, but should hold for any 8-bit job. Spot the problems:<br>
<br>
static const uint16_t setting = 15*60;<br>
class values {<br>
  uint8_t a, b, c;<br>
  uint32_t d;<br>
  uint8_t e;<br>
  uint16_t f;<br>
};<br>
static const values defaults {<br>
  50, 1, 10, 0xFFB070, 5, 0x03FF<br>
};<br>
void func() {<br>
  unsigned long ms;<br>
  ms = setting * 1000;<br>
  ...<br>
}<br>
<br>
The program doesn't work in 2 places.<br>
<br>
First solution wins a free copy of the night light firmware.<br>
<br>
First correct solution wins 2 free copies of the night light firmware.<br>
<br>
Prize giving on Monday...<br>
<span class="HOEnZb"><font color="#888888"><br>
Volker<br>
<br>
--<br>
Volker Kuhlmann<br>
<a href="http://volker.top.geek.nz/" rel="noreferrer" target="_blank">http://volker.top.geek.nz/</a>      Please do not CC list postings to me.<br>
<br>
______________________________<wbr>_________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.linuxnut.co.nz">Chchrobotics@lists.linuxnut.<wbr>co.nz</a><br>
<a href="http://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.<br>
</font></span></blockquote></div><br></div>