Re: Why does this bogus declaration compile?

From: Greg Comeau (comeau_at_panix.com)
Date: 12/13/04


Date: 13 Dec 2004 12:06:31 -0500

In article <umalxdL4EHA.2156@TK2MSFTNGP10.phx.gbl>,
Gnum <no-email@mail.boo> wrote:
>"Nikolaus Schulz" <microschulz@web.de> wrote in message
>news:323l5cF3afd86U1@individual.net...
>> Nikolaus Schulz wrote:
>> > int array_stub[];
>> > int array[10];
>> >
>> > int main()
>> > {
>> > /*ARRAY_STUB = ARRAY;*/
>>
>> *cough*
>> The line above should of course be:
>>
>> /* array_stub = array; */
>> :-)
>>
>> > }
>
>Following is the sinonimous construction :
>
>int* abc; // the same as it would be "int abc[]" OR "int abc[10]"
>int* cde;
>
>main ()
>{
> abc = cde;
>}
>
>Does it make sense now ?

You can certainly use that to produce a similar effect,
but it's definitely a different way of (maybe) doing
the same thing, and NOT the same thing. In particular, this:

>int* abc; // the same as it would be "int abc[]" OR "int abc[10]"

is not true. Arrays are not pointers, although they can be
converted to them and used interchageably in some cases.

-- 
Greg Comeau / Comeau C++ 4.3.3, for C++03 core language support
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?