"Hendrik Sattler" <[email protected]> writes:
> Zitat von "Goswin von Brederlow" <[email protected]>:
>
>> Adam Borowski <[email protected]> writes:
>>
>>> On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote:
>>>> Shachar Shemesh <[email protected]> writes:
>>>> > I've promised to get a library out there, and here it is. The base URL
>>>> > is https://github.com/Shachar/safewrite, and the actual code is at
>>>> > https://github.com/Shachar/safewrite/blob/master/safewrite.c
>>>>
>>>> Some things I noticed:
>>>>
>>>> That way one could use
>>> [..]
>>>> typedef struct {
>>>> int fd;
>>>> char buffer[PATH_MAX];
>>>> } safe_t;
>>>
>>> Except, you can't rely on PATH_MAX on any modern system. It's defined in
>>> Linux headers to an arbitrary value to make old code compile, but for
>>> example Hurd folks decided to not define it altogether to make buggy code
>>> fail during compilation rather than on runtime.
>>
>> Right, so
>>
>> typedef struct {
>> int fd;
>> char buffer[0];
>> } safe_t;
>>
>> and allocating the struct as big as needed.
>
> Maybe don't recommend invalid C? Bad habits don't have to live on forever...
>
> HS
Would you use
typedef struct {
int fd;
char buffer[];
} safe_t;
or what do you mean by invalid C?
MfG
Goswin
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]