Re: %destructor feedback

2005-12-07 Thread Tzvetan Mikov
On Wednesday 07 December 2005 04:09 pm, Joel E. Denny wrote: > > I had no idea the C standard made such restrictions on what computations > you perform with memory addresses. So the following is invalid C? > >#include >int main() { > int x; > printf( "%p\n", (void*)(&x-1) ); >

Re: %destructor feedback

2005-12-07 Thread Joel E. Denny
On Wed, 7 Dec 2005, Tzvetan Mikov wrote: There are architectures where even loading an invalid address in a register might cause an error. It is not purely theoretical either. Thanks for this information. YYUSE sure is educational. Joel ___ Help-

Re: %destructor feedback

2005-12-07 Thread Joel E. Denny
On Wed, 7 Dec 2005, Paul Eggert wrote: Would (&(e)-1) solve that? No, because that's an invalid expression: it normally has undefined behavior, and 'lint' is within its rights to warn about it. Invalid seems like a strong word. You mean that some lint implementations warn about pointer arith

Re: %destructor feedback

2005-12-07 Thread Joel E. Denny
On Wed, 7 Dec 2005, Akim Demaille wrote: "Joel" == Joel E Denny <[EMAIL PROTECTED]> writes: > On Wed, 7 Dec 2005, Akim Demaille wrote: > "Paul" == Paul Eggert <[EMAIL PROTECTED]> writes: >> >> > Why can't we simply rewrite the code so that it doesn't declare >> > unused variables? >> >> Be

Re: %destructor feedback

2005-12-07 Thread Paul Eggert
>>> Would (&(e)-1) solve that? >> >> No, because that's an invalid expression: it normally has undefined >> behavior, and 'lint' is within its rights to warn about it. > > Invalid seems like a strong word. You mean that some lint > implementations warn about pointer arithmetic on locals and params?

Re: %destructor feedback

2005-12-07 Thread Akim Demaille
>>> "Joel" == Joel E Denny <[EMAIL PROTECTED]> writes: > On Wed, 7 Dec 2005, Akim Demaille wrote: > "Paul" == Paul Eggert <[EMAIL PROTECTED]> writes: >> >> > Why can't we simply rewrite the code so that it doesn't declare >> > unused variables? >> >> Because you don't know whether yye

Re: %destructor feedback

2005-12-07 Thread Akim Demaille
>>> "Paul" == Paul Eggert <[EMAIL PROTECTED]> writes: > Why can't we simply rewrite the code so that it doesn't declare > unused variables? Because you don't know whether yyerror, for instance, will use the location, or the %parse-param. But some users need them there. __

Re: %destructor feedback

2005-12-07 Thread Joel E. Denny
On Wed, 7 Dec 2005, Akim Demaille wrote: "Paul" == Paul Eggert <[EMAIL PROTECTED]> writes: > Why can't we simply rewrite the code so that it doesn't declare > unused variables? Because you don't know whether yyerror, for instance, will use the location, or the %parse-param. But some users ne

Re: %destructor feedback

2005-12-07 Thread Joel E. Denny
On Tue, 6 Dec 2005, Paul Eggert wrote: Would (&(e)-1) solve that? No, because that's an invalid expression: it normally has undefined behavior, and 'lint' is within its rights to warn about it. Invalid seems like a strong word. You mean that some lint implementations warn about pointer arit

Re: %destructor feedback

2005-12-07 Thread Akim Demaille
I might be slightly off topic, but I have not seen any problem reported with casts to void in the case of C++. So we should probably look for a pure C solution, and let __cplusplus do the rest. But you may already have realized that already, I didn't follow the thread close enough...

Re: %destructor feedback

2005-12-07 Thread Paul Eggert
"Joel E. Denny" <[EMAIL PROTECTED]> writes: >> #define YYUSE(e) (yyunused = &(e) && yyunused) >> then I suspect it will also run afoul of lint implementations that >> deduce that &(e) can never be null, and print a warning. > > Would (&(e)-1) solve that? No, because that's an invalid expression