Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Multiple Inclusion of Header Files

David Abrahamsdave@boost-consulting.com
11 Oct 2002 09:26:42 -0400


Neal Norwitz <neal@metaslash.com> writes:> On Fri, Oct 11, 2002 at 07:48:52AM -0400, Guido van Rossum wrote:> > > > is there any reason why these files:> > > >     graminit.h> > > >     patchlevel.h> > > >     pyconfig.h (aka pyconfig.h.in)> > > >> > > > don't protect against being included multiple times?> > >> > > I think they cannot possibly be included multiple times in a correct> > > application, since a correct application does not directly include> > > them, anyway.> >> > But that's true of any .h file that's included by Python.h, isn't it?> > And there's only a handful of .h files that Python.h doesn't include...>> I don't really think there is much to be gained by adding protection.> It's unlikely the files would be included directly by an application.> Even if the files are included multiple times, the worst that should> happen is a redefined warning.Ahem. Don't forget that C++ applications may need to read thesefiles. The rules about redefinition are different in C++ IIRC.So, if these files /really/ don't need to be #included directy by anapplication, that's fine...However, I note that Boost.Python has to #include <patchlevel.h> becausewe have to apply workarounds before #including <Python.h> for certainversions of Python, so I wouldn't say that it's very unrealistic to thinkapplications might need these files separately.--            David Abrahams * Boost Consultingdave@boost-consulting.com *http://www.boost-consulting.com


[8]ページ先頭

©2009-2025 Movatter.jp