[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] malloc-less i/o: small comparison
From: |
Dmitry K. |
Subject: |
Re: [avr-gcc-list] malloc-less i/o: small comparison |
Date: |
Wed, 7 Sep 2005 09:03:26 +1100 |
User-agent: |
KMail/1.5 |
On Wednesday 07 September 2005 03:55, Joerg Wunsch wrote:
[...]
> Oh, you did that work independently from the currently running
> discussion about stdio improvements that will be in avr-libc 1.4?
>
> Too bad, I've already get everything ready to commit right now.
I have executed this experiment, after the beginning of this
discussion. (Excuse, I was mistaken in a set of the addressee,
the letter intended for 'avr-libc-dev'.)
Idea very-very simple:
File 'stdout.c':
#include <stdio.h>
#include "stdio_private.h"
struct __file stdout [1] = {
{ .flags = __SWR, .put = _putchar }
};
links, as in the program there is a reference to 'stdout', like:
fputs ("abcde", stdout);
The fully worked user program is:
#include <stdio.h>
int _putchar (char c)
{
...
}
int main ()
{
fputs ("abcde", stdout);
return 0;
}
'Opening' of stdout is not needed (like common C).
'stdio.h' changes are:
extern FILE stdout[];
extern int _putchar (char);
Stdin correction is analogous.
Dmitry.