This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 07/26/2011 09:15 AM, Tobias Burnus wrote:Secondly, I wonder what happens if malloc fails. In the current code, one directly modifies the variable such that afterwards the one has a pointer to NULL. I think from the wording of the standard, one would keep the current allocation status. I think one might need to reintroduce a temporary variable for the case that malloc fails.
Are you sure? If the variable *has* any sort of existing allocation, the code will never reach the malloc line. The malloc only happens if the variable is not already allocated, in which case, the malloc is not destroying anything.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |