Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0627eff

Browse files
committed
Don't need to explain [1] kluge anymore in xfunc.sgml.
1 parent 2e21121 commit 0627eff

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

doc/src/sgml/xfunc.sgml

+3-8
Original file line numberDiff line numberDiff line change
@@ -1885,17 +1885,12 @@ typedef struct
18851885
<programlisting>
18861886
typedef 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>

0 commit comments

Comments
 (0)