|
Boost : |
From: Luke Elliott (luke_elliott_at_[hidden])
Date: 2005-08-23 05:11:45
Vladimir Prus wrote:
> Luke Elliott wrote:
>
>
>>I was wondering why boost libraries don't do something like:
>>
>>class positional_options_description {
>> public:
>> BOOST_PROGRAM_OPTIONS_DECL positional_options_description();
>> BOOST_PROGRAM_OPTIONS_DECL void add(const char* name, int
>>max_count);
>>...
>>};
>>
>>instead of:
>>
>>class BOOST_PROGRAM_OPTIONS_DECL positional_options_description {
>> public:
>>max_count);
>>...
>>};
>>
>>in order to remove the irritating C4275 warning? i.e. only declspec
>>public, protected members (and any private members invoked from inline
>>methods).
>
>
> Well, I did what I considered to be the standard thing. I have no idea
> what's C4275 warning is, and why adding declspecs to each method is a good
> idea. Can you explain?
>
(BTW - I just used program_options as an example as that's what I was
looking at at the time...)
I don't have access to VC++ right now so this is from memory, but there
are (at least) 2 cases where it raises a warning:
class MY_LIB_DECL my_class : public some_base
{
my_class();
};
if some_base isn't a declspeced class then you get "warning non
dll-interface class used as based for dll-interface class".
class MY_LIB_DECL my_class
{
my_class();
std::string m_string;
};
Which gives "m_string must have dll-interface to be used by clients of
my_class".
Both warnings a pretty harmless hence the usual recommendation to
disable the warning, I guess.
However, the warnings can be removed by exporting only members which
truly need to be exported - I was just curious as to why it isn't done
in boost (possibly GCC issues?).
Thanks
Luke.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk