Giter Site home page Giter Site logo

Comments (4)

burlachenkok avatar burlachenkok commented on July 28, 2024

I have added C99 standard and description what is flexible array. It's a popular thing used pretty often in any kernel code for Windows and Linux.

Thanks for reference, such as:
https://wiki.sei.cmu.edu/confluence/display/c/DCL38-C.+Use+the+correct+syntax+when+declaring+a+flexible+array+member

But I try to use standards, when it's enough.

Support of varying array array. - is a misprint..

from cpp_from_1998_to_2020.

ujos avatar ujos commented on July 28, 2024

Ok, now it is more clear, however still I do not understand what is purpose of the [*]. MSVC does not support it. GCC does support but in the function prototype only. What is the difference between these below:

void foo(int arr[], size_t arrSize);
void bar(int arr[*], size_t arrSize);

from cpp_from_1998_to_2020.

ujos avatar ujos commented on July 28, 2024

If the size is not present, the array type is an incomplete type. If the size is * instead of
being an expression, the array type is a variable length array type of unspecified size,
which can only be used in declarations with function prototype scope;122) such arrays are
nonetheless complete types.

Now the question is what is incomplete type

BTW, variable length array is also array of size that is not const value:

int z = 5;
int arr[z]; // << variable length array

from cpp_from_1998_to_2020.

burlachenkok avatar burlachenkok commented on July 28, 2024
> void foo(int arr[], size_t arrSize);
> void bar(int arr[*], size_t arrSize);
> ```

- I have added incompleted type information into the glossary
- I have updated the variable-length array description
- I have removed a variable-length array that is confusing [*] notation.

> What is the difference between these below?

I don't know. I thought construction with `[*]` allows to have an incomplete type, but it's not the case.
(In experiments with `gcc -x c --std=c99` through https://godbolt.org/). For me both foo and bar is identical and nothing special I see inside https://godbolt.org/.

from cpp_from_1998_to_2020.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.