<p>George Joseph <strong>posted comments</strong> on this change.</p><p><a href="https://gerrit.asterisk.org/6662">View Change</a></p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p>(3 comments)</p><ul style="list-style: none; padding-left: 20px;"><li><p><a href="https://gerrit.asterisk.org/#/c/6662/1/include/asterisk/vector.h">File include/asterisk/vector.h:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6662/1/include/asterisk/vector.h@307">Patch Set #1, Line 307:</a> <code style="font-family:monospace,monospace"> * \param elem Element to insert.</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">\param elem Element to insert. MUST BE SCALAR or cast to a scalar.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6662/1/include/asterisk/vector.h@309">Patch Set #1, Line 309:</a> <code style="font-family:monospace,monospace"> *</code></p><ul><li>\warning 'elem' must be scalar so passing 'x' where 'x' is defined as 'char x[4]' will fail to compile.  However casting 'x' as 'char *' does result in a scalar value and CAN be used.</li></ul></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6662/1/include/asterisk/vector.h@318">Patch Set #1, Line 318:</a> <code style="font-family:monospace,monospace">     typeof(elem) __elem = (elem); \</code></p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">what's happening is that if "elem" is an array say "char[4]",<br>the expression becomes...<br>char __elem[4] = (elem);<br>which is an assignment of an array to an array which isn't valid in<br>C.</p><p style="white-space: pre-wrap; word-wrap: break-word;">You can do this however...<br>__auto_type __elem = (elem);<br>This automatically evaluates to...<br>char *__elem = (elem);</p><p style="white-space: pre-wrap; word-wrap: break-word;">Unfortunately, __auto_type may be a recent addition to gcc and<br>clang so I'm testing with docker images to see how far back it<br>goes.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Not far enough it seems. :(<br>I think the best approach is to cast CCC2 to "char *" on line 213 of test_vector.c and add the qualifier to the doc that elem must be scalar or cast to a scalar.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/6662">change 6662</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6662"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Ib960d7f5576f9e1a3c478ecb48995582a574e06d </div>
<div style="display:none"> Gerrit-Change-Number: 6662 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 06 Oct 2017 13:11:48 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>