Re: where exactly c++,c fail and Ada gets thru'



Martin Krischik <krischik@xxxxxxxxxxxxxxxxxxxxx> writes:
Keith Thompson wrote:
In fact, it's not possible in C to pass an array directly as a
function parameter.

Actually C99 can pass arrays. The declaration looks something like this:

F (int A_Lenght, double A [A_Lenght])

or

G (double A [static 10])

or even

H (double A [*])

But then: AFAIK: there is only one compiler which prides itself with
actually implementing C99 arrays and one compiler which at least tries and
and has the failures on it's bug list.

I'm fairly sure that still passes a pointer, not the actual array.
For example, the expression "sizeof(A)" inside the function will yield
the size of a pointer, not the size of the array.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: invalid use of non-lvalue array
    ... Eben _weil_ ich den Standard gelesen habe, ... C89 hat genau wie C99 den Namen eines Arrays als Zeiger auf das ... >> erste Element interpretiert. ...
    (de.comp.lang.c)
  • Re: C vs. C++
    ... In my experience, they actually prefer Fortran, but C99 has added some new features that remove some of the advantages Fortran used to have over C, from the point of view of physicists. ... Most importantly, C now has direct language level support for complex math, include a bunch of new math library functions that take complex arguments and return complex values. ... C99 has also added variable length arrays, which make it much easier to deal with arrays of data, especially multi-dimensional arrays. ... By the way, every new feature that makes C more attractive to computational physicists has been roundly criticized by people who can't imagine why any significant number of programmers would need complex numbers, multidimensional arrays, or precise control over floating point math. ...
    (comp.lang.c)
  • Re: Help a beginner - function with pointer ...
    ... Windows, for example. ... It says something about C99... ... not about arrays only. ...
    (comp.lang.c)
  • Re: Segmentation fault!
    ... almost all C compilers. ... When standardized in C99, it became known as ... You're thinking of flexible array members; variable length arrays are ...
    (comp.lang.c)
  • Re: OT: Seed7 on OS X - WAS: Re: Seeking computer-programming job (Sunnyvale, CA)
    ... C99 Rationale: ... # inability to declare arrays whose size is known only at execution time ... Adoption of some standard notion of execution time ...
    (comp.lang.c)