Re: batching gets and searching



Colm Smyth <Colm Smyth ireland sun com> writes:
> You could document a parameter using comments like:
> 
> void my_func( int /* MyFlagsEnumType */ flags )
> 
> which at least makes a correct use of the language type mechanism.
>

Well, flags are in essence a violation of the type mechanism to begin
with (Stroustrup says something to that effect in the third edition).
In C enums simply are not distinct types from int, so there's no
additional violation; in C++ the result of a bunch of enum values |'d
together is not typesafe in the same sense void* isn't.

Anyway, convention wins here. I don't think it's a sufficiently
important point to create inconsistency.

> By the way, it's a bad idea to export interfaces using C++ because
> name-mangling tends to change between compiler versions and
> is never consistent between different compilers. If the wrapper
> is small enough, it could be provided as source to be compiled
> into each client application.
> 

Remember this stuff is open source. ;-) People can compile it with
whatever compiler they want.

Linux distributions will likely ship a shared library version compiled
with the standard system compiler, since nearly everyone will use it
with that compiler. But if people want to rebuild with another
compiler and statically link they are free to do so.

And those who are worried about compiler interoperability issues can
always use the C interface.

Havoc






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