[LLVMdev] Minimum Array Size

Gergö Barany gergo at complang.tuwien.ac.at
Tue Sep 11 03:54:09 PDT 2012

On Mon, Sep 10, 2012 at 16:43:57 -0500, Hal Finkel wrote:
> clang currently seems to generate the same code for both:
> double something_a(char A[const static 256]) {
>   ...
> }
> and for:
> double something_b(char (*const A)) {
>   ...
> }
> even though in the first case the programmer has told us that the array
> A is at least 256 bytes in length (and, thus, will not be null).

Is this really the case? In what language(s)? As I understand it, the C99
standard simply states that a function argument declared as "array of T" is
equivalent to "pointer to T", so it does not really guarantee anything about
whether the argument is a non-null pointer to a valid array of the given
number of elements.

Gergö Barany, research assistant                 gergo at complang.tuwien.ac.at
Institute of Computer Languages      http://www.complang.tuwien.ac.at/gergo/
Vienna University of Technology                       Tel: +43-1-58801-58522
Argentinierstrasse 8/E185, 1040 Wien, Austria         Fax: +43-1-58801-18598

More information about the llvm-dev mailing list