Re: Warning when using const pointer to fixed size array

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

 



me22 <me22.ca@xxxxxxxxx> writes:
> 2009/12/1 Sergei Organov <osv@xxxxxxxxx>:
>> me22 <me22.ca@xxxxxxxxx> writes:
>>> 2009/12/1 Sergei Organov <osv@xxxxxxxxx>:
>>>>
>>>> void boo(const int p[9]);
>>>>
>>>> You see? Use the second, simpler declaration, and you are OK.
>>>>
>>>
>>> But then p is a pointer, not an array.
>>
>> But then in
>>
>> void foo(const int (* p)[9]);
>>
>> 'p' is also a pointer, not an array.
>>
>
> Sorry; You're of course right.
>
> I should been less specific and more useful and said, "But then you
> lose the size of the array".

Yeah, you are right, I was under impression that the

  void boo(const int p[9]);

declaration will prevent calling the boo() like this:

  int a[10];
  boo(a);

It does not.

-- Sergei.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux