speechd-discuss
[Top][All Lists]
Advanced

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

autotools and ifdefs


From: William Hubbs
Subject: autotools and ifdefs
Date: Sun, 5 Dec 2010 15:07:25 -0600

Hi Andrei, I'm moving this to a new thread, because it is digressing
into a separate subject.

On Sun, Dec 05, 2010 at 08:49:38PM +0100, Andrei Kholodnyi wrote:
> On Sun, Dec 5, 2010 at 6:47 PM, Bohdan R. Rau <ethanak at polip.com> wrote:
> > I agree.
> 
> the same /no go/ is true for such things:
> 
> +#ifdef HAVE_SAMPLERATE
> +     float rsbuf[SONIC_BUFFER_SIZE];
> +     SRC_STATE *resampler=NULL;
> +     SRC_DATA resdata;
> +#endif

I wouldn't have a problem with this #ifdef, because it is blocking off
certain statements, probably based on something defined in
config.h. If you look in other autotools projects you will see things
like this quite often. From what I remember reading, this is exactly how
the autotools manual recommends writing portable code.

For things like this, I think we just have to be careful not to overdo
it and not spread this through much of the code.

> +     if (!rate
> +#ifdef HAVE_SAMPLERATE       
> +             && !pitch
> +#endif
> +             ) {
 
 This, on the other hand, I definitely disagree with.  I do not agree
 with using #ifdef's to break up conditionals like this. It will
 definitely make things more difficult to maintain.

 William
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://lists.freebsoft.org/pipermail/speechd/attachments/20101205/60f4286d/attachment-0001.pgp>


reply via email to

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