File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -1885,17 +1885,12 @@ typedef struct
18851885<programlisting>
18861886typedef struct {
18871887 int32 length;
1888- char data[1 ];
1888+ char data[FLEXIBLE_ARRAY_MEMBER ];
18891889} text;
18901890</programlisting>
18911891
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.
18991894 </para>
19001895
19011896 <para>
You can’t perform that action at this time.
0 commit comments