tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Fun little bug...


From: Peter Lund
Subject: Re: [Tinycc-devel] Fun little bug...
Date: Wed, 05 Sep 2007 09:17:05 +0200

On Tue, 2007-09-04 at 23:29 -0500, Rob Landley wrote:
> So I'm trying to get some code I wrote (toybox) to build under tcc.  Ran into 
> the bug "cannot use pointers here", on code that (once the macros are 
> resolved) expands to:
> 
> int enable = NULL || 0;
> 
> And NULL, of course, expands to ( ( void * ) 0 ).
> 
> What tcc is saying is that NULL || 0 is illegal.

What, you are saying it isn't?

>   Which is not, in fact, the 
> case.

Hmm.  Really?

I don't believe you.  Accepting both integers AND pointer types inside
if(), while(), for() is a special case as far as I know.

I wonder if this will work:

        int enable = !!NULL || 0;

>   It's not even a warning, it's a commonish thing to do in if() 
> statements.  You can do || and && for sure, and there's defined behavior for 
> > and < too.  (The c99 draft spec is almost unreadable, by the way.)

This one?
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

> Would anyone like to comment on the if statement starting at line 4799?

I'll take a look.

> Does this chunk of code make more sense to anybody else here?

No.

-Peter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]