[cfe-dev] size of pointer and size of long

Chris Lattner clattner at apple.com
Tue Oct 21 21:40:19 PDT 2008


Eli wrote:
>> There is an assertion in the Preprocessor.cpp line 600 that assumes
>> current targets have sizeof(long) == sizeof(void *). This  
>> assumption is
>> incorrect.
>
> Yeah; the only reason Chris did that was to avoid adding a few extra
> cases to the code.  Feel free to submit a patch, or else I'm sure
> Chris will get to it soon.


Right. I just didn't know the logic to infer the preprocessor  
definitions, it should be easy to add that code.

I agree with your type proposal.


On Oct 21, 2008, at 9:25 PM, Alireza.Moshtaghi at microchip.com wrote:

> Thanks for the information,
> For now in PIC16 port, I'll be setting the size of long long to zero  
> and
> by checking that in Preprocessor.cpp, I know if long long is supported
> or not. Tentatively in the place where it is asserting, I'll leaving  
> the
> current code only for targets that have non zero long long.
> I don't know if you want me to submit this patch or not. It seems to  
> be
> working for us at least for now until the final approach is adopted.

Why not just make sizeof(long long) == sizeof(long)?  It would be  
nicer to support long long, even if it is the same size as long.

> Regarding your proposal,
> Similar enum is defined publicly in BuiltinType class. Can't that be
> used instead of creating a new enum to become source of confusion?

BuiltinType is part of the AST library.  TargetInfo is in the "Basic"  
library.  Code in 'Basic' can't use enums in AST.  Please add a new  
enum to TargetInfo.

Thanks!

-Chris




More information about the cfe-dev mailing list