Subject: Re: Preprocessor...

Re: Preprocessor...

From: Simon Josefsson <simon_at_josefsson.org>
Date: Mon, 01 Mar 2010 21:22:50 +0100

double <ninive_at_gmx.at> writes:

> Hello,
>
> In order to define the buffer-size, I would like to check the
> libssh2-version.
>
> What I did (simplifed):
>
> #if LIBSSH2_VERSION_MAJOR == 1 && LIBSSH2_VERSION_MINOR <= 2 &&
> LIBSSH2_VERSION_PATCH <= 2
> #define LIBSSH2_BUFFERSIZE 1024
> #endif
>
> The problem, libssh 1.2:
> #define LIBSSH2_VERSION_MAJOR 1
> #define LIBSSH2_VERSION_MINOR 2
> #define LIBSSH2_VERSION_PATCH
>
> Of course, GCC reports:
> ssh.cpp:30:89: error: operator '&&' has no right operand
>
> Is there a chance to check, if LIBSSH2_VERSION_PATCH is empty?

Try:

#if (LIBSSH2_VERSION_PATCH + LIBSSH2_VERSION_MINOR * 10 + LIBSSH2_VERSION_MAJOR * 100) >= 120
#define LIBSSH2_BUFFERSIZE 1024
#endif

Or something like it.

/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-01