On Wed, 2005-07-20 at 17:10 +0100, Philip Martin wrote:
> Daniel Berlin <dberlin@dberlin.org> writes:
>
> > On Tue, 2005-07-19 at 23:00 +0100, Philip Martin wrote:
> >> djames@tigris.org writes:
> >>
> >> > +static char *poolAttribute = (char *) "_pool";
> >> > +static char *assertValid = (char *) "assert_valid";
> >> > +static char *emptyTuple = (char *) "()";
> >>
> >> Casting away const is generally a bad idea, how about
> >
> > It's not just a bad idea, it doesn't actually do anything.
>
> It allows a subsequent function call to compile without a warning.
>
> > IE the compiler is free to ignore any store to something it knows was
> > originally const qualified.
>
> In this case the pointers are passed to a function that is compiled in
> a different translation unit, one that's part of the Python binary.
> When compiling that function the compiler obviously has no knowledge
> of the code above so it cannot determine whether the pointer points to
> something that was originally const.
This is a very bad assumption to make, since a lot of compilers have
whole-program modes now (including gcc), and can discern info from
libraries and how the library functions are attributed.
Assuming things like this is an very very very bad idea.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jul 20 18:46:40 2005