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) );
>
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-
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
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
>>> 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?
>>> "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
>>> "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.
__
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
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
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...
"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
11 matches
Mail list logo