Re: When to check the return value of malloc
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Sun, 03 Feb 2008 01:14:13 -0500
dj3vande@xxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
CBFalconer <cbfalconer@xxxxxxxxxxxxx> wrote:.... snip ...
Keith Thompson wrote:
The buffer behavior of getc should normally be identical to the
buffer behavior of fgetc.
Not so. The typical action of a getc macro will be something like:
[...]
totally avoiding all system calls until the buffer is emptied.
It's those intermediate system calls that can eat up the
performance.
Here's the fgetc code from a real implementation:
Where are all those intermediate system calls? I think reality
disagrees with you here.
Nothing forces any implementation to supply such a macro. The
better systems do, if possible.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: When to check the return value of malloc
- From: pete
- Re: When to check the return value of malloc
- From: pete
- Re: When to check the return value of malloc
- From: Ian Collins
- Re: When to check the return value of malloc
- References:
- Re: When to check the return value of malloc
- From: Keith Thompson
- Re: When to check the return value of malloc
- From: CBFalconer
- Re: When to check the return value of malloc
- From: dj3vande
- Re: When to check the return value of malloc
- Prev by Date: Re: xmalloc string functions
- Next by Date: Re: When to check the return value of malloc
- Previous by thread: Re: When to check the return value of malloc
- Next by thread: Re: When to check the return value of malloc
- Index(es):
Relevant Pages
|