Re: Bug#134020: Patch to build python-apt with g++-3.0
On Sat, Feb 23, 2002 at 10:59:14PM -0700, Jason Gunthorpe wrote:
> On Sun, 24 Feb 2002, Matt Zimmerman wrote:
>
> > apt folk: does this look reasonable to you? I had to get rid of those funky
> > array declarations by shuffling things around, make two minor namespace
> > tweaks, and use string::c_str() instead of string::begin(). Works for me.
>
> Hmm, gcc 3 does not like the forward declaration of the static array? How
> strange. My reading of the C99 spec suggests this is valid syntax. You
> might want to try specifying the size instead of leaving it unspecified.
Correct. I wasn't sure whether 2.95 just happened accepted it, or whether
it was truly valid syntax. It isn't really necessary if things are declared
in order.
I did try specifying the size, in just the forward declaration:
python/configuration.cc:437: redefinition of `PyMethodDef CnfMethods[]'
python/configuration.cc:28: `PyMethodDef CnfMethods[16]' previously declared
here
and in both places identically:
python/configuration.cc:437: redefinition of `PyMethodDef CnfMethods[16]'
python/configuration.cc:28: `PyMethodDef CnfMethods[16]' previously declared
here
The patch was the only way that I could get 3.0 to compile it.
> 'using namespace std;' near the top of the file is prefered to sprinkling
> std:: everywhere.
I only sprinkled std:: in the headers (exactly one place actually), and used
'using namespace std' in the .cc modules (I believe only one or two needed
it). That is what I usually do, in order to avoid having the 'using'
declarations inherit in unexpected ways.
--
- mdz
Reply to: