C99 Features
Nico Williams
nico at cryptonector.com
Fri Jun 19 15:02:00 EDT 2015
On Thu, Jun 18, 2015 at 01:13:40AM +0000, Danilo Almeida wrote:
> <quote from="Nico">
> Both are fine when the sizes are naturally limited to small sizes, but
> this requires more review effort. Alternatively one could have a
> macro to guard against unsafe array sizes. I'd rather VLAs and
> alloca() were frowned upon (though not forbidden).
> </quote>
>
> I am not sure how such a macro would work.
A macro could work for alloca:
void *alloca_abort() { abort(); }
#define GUARDED_ALLOCA(requested, max) \
(requested <= max ? alloca(requested) : alloca_abort())
Obviously there may be other failure handling options.
Nico
--
More information about the krbdev
mailing list