mozilla

Compare Revisions

Working with data

Change Revisions

Revision 98261:

Revision 98261 by Sheppy on

Revision 98262:

Revision 98262 by Sheppy on

Title:
Working with data
Working with data
Slug:
Mozilla/js-ctypes/Using_js-ctypes/Working_with_data
Mozilla/js-ctypes/Using_js-ctypes/Working_with_data
Tags:
JavaScript, js-ctypes
JavaScript, js-ctypes
Content:

Revision 98261
Revision 98262
tt116      Quirks in equality
117    </h2>
118    <p>
119      Equality doesn't work the same way in JavaScript as it does
 > in C, which means certain operations might not work the way you 
 >expect. In particular, comparing two different objects that are r
 >epresented under-the-hood as JavaScript objects using the <code>=
 >=</code> or <code>===</code> operators will always return <code>f
 >alse</code>. This affects comparisons of pointers, integers that 
 >are the same size as pointers, and 64-bit integers.
120    </p>
121    <p>
122      <em>More information coming soon.</em>
123    </p>
124    <h2>
125      64-bit integers
126    </h2>
127    <p>
128      While most numeric types in js-ctypes are represented by st
 >andard JavaScript <a href="/cn/Core_JavaScript_1.5_Reference/Glob
 >al_Objects/Number" title="cn/Core JavaScript 1.5 Reference/Global
 > Objects/Number"><code>Number</code></a> objects, 64-bit integers
 > cannot all be represented accurately by this type. For that reas
 >on, 64-bit and pointer-sized C values of numeric types don't get 
 >automatically converted to JavaScript numbers. Instead, they're c
 >onverted to JavaScript objects of the type <code>ctypes.Int64</co
 >de> and <code>ctypes.UInt64</code>.
129    </p>
130    <p>
131      Because these aren't standard numeric types, you can't use 
 >arithmetic operators on them. Instead, you'll have to use the pro
 >vided convenience functions.
132    </p>
133    <div class="note">
134      <strong>Note:</strong> These 64-bit integer types are inten
 >tionally low on features, so that when JavaScript adds a "big num
 >ber" type, we can easily upgrade to support that properly.
135    </div>
136    <h2>

Back to History