Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-01-08 20:14:03


At 05:17 PM 1/8/2003, William E. Kempf wrote:

>> From: Rene Rivera <grafik666_at_[hidden]>
>> I rather dislike the conditional compilation solution. It makes it
rather
>> harder to write portable code as it makes for doing conditional PP code
>> outside of the library. Would it not be preferable to throw some form
of
>> "unimplemented"/"unsupported" exception? Another option would be a
>discovery
>> interface to find out what's supported in the platform. Such a
discovery
>> interface could be used with MPL to get the equivalent of PP.
>
>Note that we do throw exceptions in many cases where things aren't
>supported. However, if a large category of functionality is not
available,
>such as scheduling, there's reasons to prefer conditional compilation.
>First, you can get rid of unecessary code. Second, you know from
attempts
>to compile whether or not code can actually be ported to a given
platform.
>IOW, the exception approach is only useful when you can compensate for
the
>lack of a feature at run time.

I'm not a fan of conditional compilation either.

I'd rather see the functions always supplied, even as stubs, unless it is
absolutely sure that every use represents a serious error.

For example, setting the stack size may have no effect on some platforms,
but why should it be considered an error?

There could be a compile time way to tell if the feature has any effect, so
if the user wishes to tailor the code, it is possible to do so.

Particularly between major platforms like POSIX and Windows, I'd hope that
programs could be moved back and forth without user code being concerned
about presence or absence of features.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk