[prev in list] [next in list] [prev in thread] [next in thread]
List: pcc-list
Subject: Re: Pointers to arrays
From: Anders Magnusson <ragge () ludd ! ltu ! se>
Date: 2008-06-22 19:23:50
Message-ID: 485EA6C6.8070800 () ludd ! ltu ! se
[Download RAW message or body]
KAMADA Ken'ichi wrote:
> At Sat, 21 Jun 2008 18:35:27 +0200,
> Anders Magnusson wrote:
>>> /Users/greg/src/netbsd/current/src/sys/arch/x86/isa/clock.c, line 733:
>>> warning: implicit conversion of argument 1 due to prototype
>>> /Users/greg/src/netbsd/current/src/sys/arch/x86/isa/clock.c, line 757:
>>> warning: implicit conversion of argument 1 due to prototype
>>> /Users/greg/src/netbsd/current/src/sys/arch/x86/isa/clock.c, line 774:
>>> warning: implicit conversion of argument 1 due to prototype
>> So, fixed now (I hope...). I checked with the original compiler, and it
>> was accepted even though the generated
>> parse trees were quite different (but the resulting code were ok). And
>> because it didn't have prototypes
>> no warnings were emitted :-)
>
> Well, "a pointer to an array of T" is very different from
> "a pointer to T", so a warning should be emitted if one of these types
> is implicitly converted to the other.
>
> int
> main()
> {
> char *a;
> char (*b)[10];
>
> printf("%p %p\n", a, a + 1); /* 1 byte */
> printf("%p %p\n", b, b + 1); /* 10 bytes */
> }
>
> I think the root of the problem is that pcc ignores & before an array.
> The result of "&array" shall be "a pointer to an array" (at least in
> C99 world).
>
Yes, even though this only get a problem for type correctness in the
case referred to, no code errors. But nevertheless it should be fixed
sometime in the future.
-- Ragge
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic