|
From: | Paolo Bonzini |
Subject: | Re: [PATCH] inttostr.h: add compile-time buffer overrun checks |
Date: | Mon, 25 Oct 2010 12:09:51 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3 |
On 10/25/2010 03:40 AM, Paul Eggert wrote:
+/* Easier-to-use macros, which don't require a string buffer argument. + They can be used in code that assumes C99-style compound literals. + They return a pointer to storage with scope equal to that of the + enclosing block. */ +#define int2str_call(t, func, n) \ + func (n, ((char [INT_BUFSIZE_BOUND (t)]) {0,}))
Maybe this could use "func (n, alloca (INT_BUFSIZE_BOUND (t)))" if C99 is not in use? Alloca and VLA are not compatible, but if you are not using C99 then you are not using VLAs.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |