[
https://issues.apache.org/jira/browse/MAPREDUCE-1166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796473#action_12796473
]
Allen Wittenauer commented on MAPREDUCE-1166:
---------------------------------------------
So I spent some time looking at this today and trying to get this to work with
VLAs in SunStudio. Doing research, I ran across this:
http://forums.sun.com/thread.jspa?threadID=5348093
"C99 VLAs were discussed in the C++ Committee for possible inclusion in the
next standard. The unanimous view was that they did not have nice properties
(the word "suck" was bandied about), and that std::vector or other containers
were a superior solution in C++ programming."
Thus, while __func__ works with CC -features=extensions, it doesn't appear that
Sun Studio supports all of the C99 features in their C++ compiler. This makes
me wonder if using __func__ was the right thing to do now.
They also have an interesting discussion about alloca vs. malloc.
> SerialUtils.cc: dynamic allocation of arrays based on runtime variable is not
> portable
> --------------------------------------------------------------------------------------
>
> Key: MAPREDUCE-1166
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-1166
> Project: Hadoop Map/Reduce
> Issue Type: Bug
> Reporter: Allen Wittenauer
> Assignee: Allen Wittenauer
> Attachments: MAPREREDUCE-1166.patch
>
>
> In SerialUtils.cc, the following code appears:
> int len;
> if (b < -120) {
> negative = true;
> len = -120 - b;
> } else {
> negative = false;
> len = -112 - b;
> }
> uint8_t barr[len];
> as far as I'm aware, this is not legal in ANSI C and will be rejected by ANSI
> compliant compilers. Instead, this should be malloc()'d based upon the size
> of len and free()'d later.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.