File tree 1 file changed +3
-8
lines changed
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -1885,17 +1885,12 @@ typedef struct
1885
1885
<programlisting>
1886
1886
typedef struct {
1887
1887
int32 length;
1888
- char data[1 ];
1888
+ char data[FLEXIBLE_ARRAY_MEMBER ];
1889
1889
} text;
1890
1890
</programlisting>
1891
1891
1892
- Obviously, the data field declared here is not long enough to hold
1893
- all possible strings. Since it's impossible to declare a variable-size
1894
- structure in <acronym>C</acronym>, we rely on the knowledge that the
1895
- <acronym>C</acronym> compiler won't range-check array subscripts. We
1896
- just allocate the necessary amount of space and then access the array as
1897
- if it were declared the right length. (This is a common trick, which
1898
- you can read about in many textbooks about C.)
1892
+ The <literal>[FLEXIBLE_ARRAY_MEMBER]</> notation means that the actual
1893
+ length of the data part is not specified by this declaration.
1899
1894
</para>
1900
1895
1901
1896
<para>
You can’t perform that action at this time.
0 commit comments