[Asterisk-code-review] vector: multiple evaluation of elem in AST VECTOR ADD SORTED. (asterisk[15])

George Joseph asteriskteam at digium.com
Fri Oct 6 07:27:19 CDT 2017


George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/6662 )

Change subject: vector: multiple evaluation of elem in AST_VECTOR_ADD_SORTED.
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/6662/1/include/asterisk/vector.h
File include/asterisk/vector.h:

https://gerrit.asterisk.org/#/c/6662/1/include/asterisk/vector.h@318
PS1, Line 318: 	typeof(elem) __elem = (elem); \
what's happening is that if "elem" is an array say "char[4]",
 the expression becomes...
char __elem[4] = (elem);
which is an assignment of an array to an array which isn't valid in C.

You can do this however...
__auto_type __elem = (elem);
This automatically evaluates to...
char *__elem = (elem);

Unfortunately, __auto_type may be a recent addition to gcc and clang so I'm testing with docker images to see how far back it goes.



-- 
To view, visit https://gerrit.asterisk.org/6662
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib960d7f5576f9e1a3c478ecb48995582a574e06d
Gerrit-Change-Number: 6662
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Comment-Date: Fri, 06 Oct 2017 12:27:19 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171006/140a997c/attachment.html>


More information about the asterisk-code-review mailing list