[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] fflush() implementation

From: Weddington, Eric
Subject: Re: [avr-libc-dev] fflush() implementation
Date: Fri, 24 Aug 2012 21:54:34 +0000

> -----Original Message-----
> From: address@hidden [mailto:avr-
> address@hidden On Behalf Of Daniel
> Otte
> Sent: Friday, August 24, 2012 1:55 PM
> To: address@hidden
> Subject: [avr-libc-dev] fflush() implementation
> So a possible solution would be to extend the __file struct with a field
> containing a pointer to a driver provided flush-function and registering this
> function via a dedicated function. This has the two cons, that the structure
> would require more space (2 bytes) and that another auxiliary function is
> required.

I would prefer this solution over changing the prototype of the supplied 

Of course, I don't like much adding a couple of bytes to the FILE structure for 
a field that is rarely used. But then again, there are tradeoffs wherever you 
go and resources of some sort will be needed to implement this functionality. 

The registration function could be an inline function or macro, since all it 
will do will be to assign the function pointer to the structure field.

It's a simple matter to add code to fflush() to check if the field is not NULL 
and to call the registered callback function.

BTW, thank you for offering to write up the patch! :-) That helps immensely 
when proposing new functionality!

I'll wait to see what Joerg has to say about all this...

Eric Weddington

reply via email to

[Prev in Thread] Current Thread [Next in Thread]