|
Boost : |
From: Corrado Zoccolo (czoccolo_at_[hidden])
Date: 2007-11-07 15:18:43
This can cause warnings on various gcc versions, if the header file is
included in a translation unit in which those constants are not used.
The inline function, instead, will cause no problem.
Corrado
On Nov 7, 2007 9:14 PM, Michael Marcin <mmarcin_at_[hidden]> wrote:
> Martin Bonner wrote:
> > Thorsten Ottosen wrote:
> >> Martin Bonner skrev:
> >>
> >>>>> namespace boost
> >>>>> {
> >>>>> namespace ptr_container_detail
> >>>>> {
> >>>>> const char* count = "count";
> >>>>> const char* item = "item";
> >>>>> const char* first = "first";
> >>>>> const char* second = "second";
> >>>>> }
> >>>>> }
> >>>> Thanks. Is there an easy way to fix it?
> >>>>
> >>>> -Thorsten
> >>> One option would be:
> >>> namespace ptr_container_detail
> >>> {
> >>> const char* count() { return "count"; }
> >> with an "inline" in front of each function, I presume?
> >
> > Oops! I missed that they are namespace level rather than class members.
> >
> >
> > Yes, an "inline" would improve things markedly.
> >
> >
>
> Err don't you just need to make them const so that they have internal
> linkage?
>
> i.e.
>
> namespace boost
> {
> namespace ptr_container_detail
> {
> const char* const count = "count";
> const char* const item = "item";
> const char* const first = "first";
> const char* const second = "second";
> }
> }
>
>
> Thanks,
>
> Michael Marcin
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
-- __________________________________________________________________________ dott. Corrado Zoccolo mailto:zoccolo_at_[hidden] PhD - Department of Computer Science - University of Pisa, Italy --------------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk