Arsen Arsenović wrote:
... or such.  (didn't try either snippet, but both should be mostly
right.  Maybe even plain 'new' works and we can drop 'gomp_malloc' usage
altogether, given that we should be able to link libsupc++; that should
throw in case of being out of memory, and, since we have no exceptions,
crash, I think?)

I think you don't mean crash but abort. - However, the whole point of
gomp_malloc is to avoid crashes without diagnostic in the
failue case. Hence, the current code reads as:

void *
gomp_malloc (size_t size)
{
  void *ret = malloc (size);
  if (ret == NULL)
    gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
  return ret;
}

* * *

In any case, I think it probably makes most sense to do '(type)' style
first - being compatible with C and C++ - and once everything is converted,
we can still think about how to handle it best as cleanup step.

Tobias

Reply via email to