diff options
author | Peter Eisentraut | 2012-06-24 22:51:46 +0000 |
---|---|---|
committer | Peter Eisentraut | 2012-06-24 22:51:46 +0000 |
commit | b8b2e3b2deeaab19715af063fc009b7c230b2336 (patch) | |
tree | c6ee1310487d59e37e3e143835b5609e78524f65 /doc/src | |
parent | 7eb8c7851458eb88def80c290a4b5bc37cc321f3 (diff) |
Replace int2/int4 in C code with int16/int32
The latter was already the dominant use, and it's preferable because
in C the convention is that intXX means XX bits. Therefore, allowing
mixed use of int2, int4, int8, int16, int32 is obviously confusing.
Remove the typedefs for int2 and int4 for now. They don't seem to be
widely used outside of the PostgreSQL source tree, and the few uses
can probably be cleaned up by the time this ships.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/xfunc.sgml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index e2b10703ee9..7b2d2b0ad39 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1739,6 +1739,13 @@ PG_MODULE_MAGIC; /* 4-byte integer, passed by value */ typedef int int4; </programlisting> + + (The actual PostgreSQL C code calls this type <type>int32</type>, because + it is a convention in C that <type>int<replaceable>XX</replaceable></type> + means <replaceable>XX</replaceable> <emphasis>bits</emphasis>. Note + therefore also that the C type <type>int8</type> is 1 byte in size. The + SQL type <type>int8</type> is called <type>int64</type> in C. See also + <xref linkend="xfunc-c-type-table">.) </para> <para> @@ -1801,7 +1808,7 @@ typedef struct <programlisting> typedef struct { - int4 length; + int32 length; char data[1]; } text; </programlisting> @@ -1913,7 +1920,7 @@ memcpy(destination->data, buffer, 40); </row> <row> <entry><type>smallint</type> (<type>int2</type>)</entry> - <entry><type>int2</type> or <type>int16</type></entry> + <entry><type>int16</type></entry> <entry><filename>postgres.h</filename></entry> </row> <row> @@ -1923,7 +1930,7 @@ memcpy(destination->data, buffer, 40); </row> <row> <entry><type>integer</type> (<type>int4</type>)</entry> - <entry><type>int4</type> or <type>int32</type></entry> + <entry><type>int32</type></entry> <entry><filename>postgres.h</filename></entry> </row> <row> |