This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Cast in c-pretty-print.c causes warning


2009/9/2 Richard Henderson <rth@redhat.com>:
> On 09/02/2009 12:50 PM, Kai Tietz wrote:
>>
>> 2009/9/2 Gabriel Dos Reis<dosreis@gmail.com>:
>>>
>>> On Mon, Aug 31, 2009 at 1:13 PM, Kai Tietz<ktietz70@googlemail.com>
>>> ?wrote:
>>>>
>>>> Hi,
>>>>
>>>> In general it is bad to use size_t to cast point to scalar, but here
>>>> in c-pretty-print.c is looks ok, as the scalar is truncated to an
>>>> unsigned int type here and just the lowest 16-bit are in fact used.
>>>> So here the patch for it
>>>
>>> I'm not sure the 'size_t' trick makes the code clearer. ?In fact, I
>>> believe
>>> we want uintptr_t -- but, in the form that OK with C90 compilers.
>>>
>> Right, by this reason we use in w64 not the gnu stdint.h header.
>
> I think you've lost the plot. ?The gnu stdint.h header should
> have the correct definition of uintptr_t even for w64. ?If not,
> then that's what should be fixed.
>
>> We
>> define uintptr_t/intptr_t/size_t etc with __extension__ to avoid those
>> warnings.
>> I can introduce here an new type __extension__ typedef __SIZE_TYPE__
>> c90_size_t;, if you prefer.
>
> Huh?!? ?What exactly do you think __extension__ will accomplish?
>
>
> r~
>

Well, I meant here stddef.h file too btw. If you try to use long long
in C90, you will get warnings. By using __extension__ you can avoid
them.

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]