Re: [linux-audio-dev] light C++ set for WAV

From: Paul Coccoli <pcoccoli@email-addr-hidden>
Date: Wed Jul 26 2006 - 21:03:40 EEST

On 7/26/06, Erik de Castro Lopo <mle+la@email-addr-hidden-nerd.com> wrote:
> Taybin Rutkin wrote:
>
> > I prefer the unix-y open_read(). I don't think method names should
> > ever start with a capital, unless it's the ctor or dtor.
>
> I'm actually tending towards openRead().
>

I vote for Java (SmallTalk?) style too.

> > I noticed that the constructor SndFile::SndFile (const char *path,
> > int mode, SF_INFO *sfinfo)
> > isn't declared in the class. Also, since this constructor can fail
> > if sf_open() fails up, it should throw an exception. Maybe
> > containing the results of sf_strerror().
> >
> > Something like
> >
> > SndFile::SndFile (const char *path, int mode, SF_INFO *sfinfo)
> > {
> > psf = sf_open (path, mode, sfinfo) ;
> > if (!psf) {
> > throw sf_error(psf);
> > }
> > }
>
> Good tip, thanks.
>
> Erik
> --
> +-----------------------------------------------------------+
> Erik de Castro Lopo
> +-----------------------------------------------------------+
> "If you think C++ is not overly complicated, just what is a
> protected abstract virtual base pure virtual private destructor
> and when was the last time you needed one?" -- Tom Cargill
>

I wouldn't bother with openRead/Write; just pass the mode in to open
like in the ctor.

I also second keeping the implementation entirely in the header (if it
really is a light wrapper) and put "inline" in front of each method
definition.

SndFile::strerror() should maybe take an int arg (the value returned
by SndFile::error()) and be declared as a static method?
Received on Thu Jul 27 00:15:05 2006

This archive was generated by hypermail 2.1.8 : Thu Jul 27 2006 - 00:15:05 EEST