Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As the "GNU C Library Reference Manual" says</p> <pre><code>off_t This is a signed integer type used to represent file sizes. In the GNU C Library, this type is no narrower than int. If the source is compiled with _FILE_OFFSET_BITS == 64 this type is transparently replaced by off64_t. </code></pre> <p>and</p> <pre><code>off64_t This type is used similar to off_t. The difference is that even on 32 bit machines, where the off_t type would have 32 bits, off64_t has 64 bits and so is able to address files up to 2^63 bytes in length. When compiling with _FILE_OFFSET_BITS == 64 this type is available under the name off_t. </code></pre> <p>Thus if you want reliable way of representing file size between client and server, you can:</p> <ol> <li>Use <code>off64_t</code> type and <code>stat64()</code> function accordingly (as it fills structure <code>stat64</code>, which contains <code>off64_t</code> type itself). Type <code>off64_t</code> guaranties the same size on 32 and 64 bit machines.</li> <li>As was mentioned before compile <strong>your code</strong> with <code>-D_FILE_OFFSET_BITS == 64</code> and use usual <code>off_t</code> and <code>stat()</code>.</li> <li><p>Convert <code>off_t</code> to type <code>int64_t</code> with fixed size (C99 standard). <strong>Note:</strong> (my book <strong>'C in a Nutshell'</strong> says that it is C99 standard, but optional in implementation). The newest C11 standard says:</p> <pre><code>7.20.1.1 Exact-width integer types 1 The typedef name intN_t designates a signed integer type with width N , no padding bits, and a two’s complement representation. Thus, int8_t denotes such a signed integer type with a width of exactly 8 bits. without mentioning. </code></pre> <p>And about implementation:</p> <pre><code>7.20 Integer types &lt;stdint.h&gt; ... An implementation shall provide those types described as ‘‘required’’, but need not provide any of the others (described as ‘‘optional’’). ... The following types are required: int_least8_t uint_least8_t int_least16_t uint_least16_t int_least32_t uint_least32_t int_least64_t uint_least64_t All other types of this form are optional. </code></pre></li> </ol> <p>Thus, in general, C standard can't guarantee types with fixed sizes. But most compilers (including gcc) support this feature.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload