James Courtier-Dutton wrote:
> 
> I generally prefer the value returned from a function to be the error code
> and
> function parameters passed to a function call, to also act as the return
> method for any extra information which needs returning.
> 
> It makes the source look neater.
> 
> So I prefer: -
> int snd_pcm_mmap_commit(snd_pcm_t *pcm,
>                          snd_pcm_uframes_t offset,
>                          snd_pcm_uframes_t frames,
>                          snd_pcm_uframes_t *committed);
> 

I'd like to make clear that 
snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
                                      snd_pcm_uframes_t offset,
                                      snd_pcm_uframes_t frames);

is perfectly analogue to snd_pcm_write/read and have the same
benefits/drawback.

I say this to precise that changing one will imply changing all.

Jaroslav wrote:

> I see the benefit of the extra parameter, that we can return the error
> code and transfer count in one pass. Otherwise the error code can be lost
> or returned later using another function like snd_pcm_avail_update() etc..

I see the benefits of that, but please don't consider asymmetric
changes.

However I'm wondering why Unix read/write does not have considered that
(yes, I'm serious).

Perhaps only because error will be returned on next call and taken for
granted that a partial transfer definitely imply a next call, they have
considered the early return of error a little benefit.

-- 
Abramo Bagnara                       mailto:[EMAIL PROTECTED]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy

ALSA project               http://www.alsa-project.org
It sounds good!

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to