[Asterisk-code-review] headers: Replace typeof with typeof . (asterisk[master])

Alexander Traud asteriskteam at digium.com
Sat Feb 17 10:08:56 CST 2018


Alexander Traud has posted comments on this change. ( https://gerrit.asterisk.org/8061 )

Change subject: headers: Replace typeof with __typeof__.
......................................................................


Patch Set 1:

Actually, an answer was not planned. I hoped for an independent third opinion.

> None of the Asterisk headers are general purpose.

You never know where your headers end-up. Actually in Ubuntu, the Asterisk headers are placed in the general purpose include directory, see <https://packages.ubuntu.com/xenial-updates/asterisk-dev>. Furthermore, external modules exist already which use these headers, for example my very own audio codecs. I see no reason, why Asterisk should not be a role model here.

> We require GCC extensions.

That is OK. However, with 4x4 underscores, that SNMP module builds even without GCC extensions. I see no reason why Asterisk should limit a possible broader compatibility artificially.

> Something is disabling GCC extensions and that is the actual bug.

I disagree, see above. It is another bug.

> We use typeof in 94 lines of header files, none of them currently use __typeof__.

As explained, these are DEFINEs which are not unfolded within the headers itself. I tested this by including various other headers. I found only the changed DEFINE. That is affected because it is unfolded within another header. Yes, this makes this change awkward, yes. If you like, for consistency, I change all typeof to __typeof__ in the header files. I prefer that actually.

> __typeof__ is less readable.

Form follows function.

Again, I want to iterate that these 4x4 missing underscores prevent Asterisk to be made (!) on FreeBSD 11. Of course, I could report this to the maintainer of that port in FreeBSD. However, I doubt this is going to trickle into FreeBSD soon. Of course, the user could go for
pkg delete net-snmp
Of course, the user could find that other culprit <https://svnweb.freebsd.org/ports/head/net-mgmt/net-snmp/?view=log> and built that port himself.

On the other hand, 4x4 underscores allow not only Asterisk to be built on FreeBSD with the current SNMP port, but even lower the requirements of external modules, for those using the header files in future.


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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0d7a2c62ed256cca19a50340e3c337567ac78e58
Gerrit-Change-Number: 8061
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Comment-Date: Sat, 17 Feb 2018 16:08:56 +0000
Gerrit-HasComments: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180217/26d66d49/attachment.html>


More information about the asterisk-code-review mailing list