arrays...

Larry Jones scjones at sdrc.UUCP
Wed May 4 11:05:49 AEST 1988


In article <5773 at sigi.Colorado.EDU>, swarbric at tramp.Colorado.EDU (Frank Swarbrick) writes:
> Is there some reason why you can do:
>    int ary[] = {1,2,3,4};
>    foo(ary);
> but you can't do
>    foo({1,2,3,4});

Yep, there's quite a good reason -- just what is {1,2,3,4} supposed to be?
An array of ints?  An array of chars?  Could even be an array of floats or
doubles!  If the compiler has to see how the thing is being used in order
to figure out what it is, it going to be MUCH harder to write, much larger,
much slower, and probably much less correct!

----
Larry Jones                         UUCP: ...!sdrc!scjones
SDRC                                AT&T: (513) 576-2070
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150
"When all else fails, read the directions."



More information about the Comp.lang.c mailing list