Many thanks, I was sure you'll have some idea for the empty __HARBOUR__ macro :)

This makes manual HB_PRE10 unnecessary.

Brgds,
Viktor

On Wed, Jun 3, 2009 at 12:31 PM, Przemyslaw Czerpak <dru...@acn.waw.pl> wrote:
> On Wed, 03 Jun 2009, Alexander S.Kresin wrote:
>
> Hi,
>
>>> Two macro solutions and better (automatic) replacements:
>>> ---
>>> #if ( defined( HARBOUR_VER_AFTER_101 ) )
>>> ->
>>> #if defined( __HARBOUR__ ) && __HARBOUR__ > 0x010100
>>> ---
>>> ---
>>> #elif defined( HARBOUR_VER_BEFORE_100 )
>>> ->
>>> #if ! defined( __HARBOUR__ )
>>> ---
>>  The problem is that __HARBOUR__ was defined before 1.00, but it hadn't a
>> number, so with an old version
>> #if ! defined( __HARBOUR__ )
>> will always a FALSE and the
>> #if defined( __HARBOUR__ ) && __HARBOUR__ > 0x010100
>> will give the compile error.
>
> It can be quite easy resolved for both C .prg preprocesors.
> For C code instead of:
>   #if defined( __HARBOUR__ ) && __HARBOUR__ > 0x010100
> simply use:
>   #if defined( __HARBOUR__ ) && __HARBOUR__ - 0 > 0x010100
>
> and for .prg code instead of:
>   #if defined( __HARBOUR__ ) .and. __HARBOUR__ > 0x010100
> use:
>   #if defined( __HARBOUR__ ) .and. __HARBOUR__ - 0 > 0x010100
>
> && in .prg code is comment marker and stripped with rest of line
> so .AND. has to be used instead.
>
> I think that such auto detection is better and much safer then manual
> setting by user.
>
> best regards,
> Przemek
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to