<div dir="ltr"><span style="line-height:17.7273px">| It's because packetLength, keyIdLength, digestLength could be redefined using</span><br style="line-height:17.7273px"><span style="line-height:17.7273px">#define so it may not be constant. It wants it to be:</span><div><span style="line-height:17.7273px"><br></span></div><div><span style="line-height:17.7273px">That can't be right. #define is done by the preprocessor, so what the compiler sees *is* </span></div><div><span style="line-height:17.7273px"> </span><span style="line-height:17.7273px">const int totalLength = 16 + 4 + 16;</span></div><div><span style="line-height:17.7273px"><br></span></div><div><span style="line-height:17.7273px">Hal, I suggest seting the flag in the compiler to dump the output of the prepropressor, and find the expression, and see if it's a constant expression or not.</span></div><div><span style="line-height:17.7273px"><br></span></div><div><span style="line-height:17.7273px">..m</span></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 25, 2015 at 12:38 PM Amar Takhar <<a href="mailto:verm@darkbeer.org">verm@darkbeer.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2015-11-25 12:24 -0800, Hal Murray wrote:<br>
> [175/204] Compiling tests/libntp/a_md5encrypt.c<br>
> ../tests/libntp/a_md5encrypt.c:30:25: error: initializer element is not constant<br>
> const int totalLength = packetLength + keyIdLength + digestLength;<br>
><br>
> I can't figure out what's going on. It looks reasonable to me.<br>
><br>
> const int packetLength = 16;<br>
> const int keyIdLength = 4;<br>
> const int digestLength = 16;<br>
> const int totalLength = packetLength + keyIdLength + digestLength;<br>
><br>
> In case it matters, that's from a Fedora 22 system.<br>
> gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)<br>
<br>
It's because packetLength, keyIdLength, digestLength could be redefined using<br>
#define so it may not be constant. It wants it to be:<br>
<br>
const int totalLength = 36; or 16 + 4 + 16 this way it cannot be changed.<br>
<br>
That's quite pedantic I like it. I didn't even get a warning under CLang 3.4.1.<br>
<br>
I'll put in a temp fix and mark it for looking at later on.<br>
<br>
<br>
Amar.<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@ntpsec.org" target="_blank">devel@ntpsec.org</a><br>
<a href="http://lists.ntpsec.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ntpsec.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>