Difference between revisions of "Portability and performance"

From D Wiki
Jump to: navigation, search
(size_t)
 
m (= Portability and Performance)
 
Line 1: Line 1:
=== Portability and Performance ==
+
== Portability and Performance ==
 
On code created today for 32-bit CPUs that may need to be used on 64-bit or larger CPUs in the future.
 
On code created today for 32-bit CPUs that may need to be used on 64-bit or larger CPUs in the future.
  

Latest revision as of 21:42, 23 November 2012

Portability and Performance

On code created today for 32-bit CPUs that may need to be used on 64-bit or larger CPUs in the future.

per Walter from the D forum:

For a loop index, you should use 'size_t'. This is because the offset to a pointer will increase in size on 64 bit machines. size_t is defined in object.d.

The D spec defines int as a signed 32 bit integer. size_t is "an alias for an unsigned integral type spanning the address space"