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?


Relevant Pages

  • Re: writing to a string
    ... If you mean file sorting then you'd be using ... >guranteed to work on any platfrom in existence then you are no longer just ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: <ctype.h> toLower()
    ... >> Assigning anything to a constant string literal brings up undefined ... >> int main ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: fstream
    ... >|>int main ... >| I forget the exact dis/allowances here, but I'd just like to point ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: [9fans] "Blocks" in C
    ... function pointers. ... scoping rules or something in that other language. ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (comp.os.plan9)
  • Re: Converting C++2C?
    ... >would like to translate into ANSI C. Does anyone know a good ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (comp.unix.programmer)