JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris Dynamic Tracing Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Types, Operators, and Expressions

Identifier Names and Keywords

Data Types and Sizes

Constants

Arithmetic Operators

Relational Operators

Logical Operators

Bitwise Operators

Assignment Operators

Increment and Decrement Operators

Conditional Expressions

Type Conversions

Precedence

3.  Variables

4.  D Program Structure

5.  Pointers and Arrays

6.  Strings

7.  Structs and Unions

8.  Type and Constant Definitions

9.  Aggregations

10.  Actions and Subroutines

11.  Buffers and Buffering

12.  Output Formatting

13.  Speculative Tracing

14.  dtrace(1M) Utility

15.  Scripting

16.  Options and Tunables

17.  dtrace Provider

18.  lockstat Provider

19.  profile Provider

20.  fbt Provider

21.  syscall Provider

22.  sdt Provider

23.  sysinfo Provider

24.  vminfo Provider

25.  proc Provider

26.  sched Provider

27.  io Provider

28.  mib Provider

29.  fpuinfo Provider

30.  pid Provider

31.  plockstat Provider

32.  fasttrap Provider

33.  User Process Tracing

34.  Statically Defined Tracing for User Applications

35.  Security

36.  Anonymous Tracing

37.  Postmortem Tracing

38.  Performance Considerations

39.  Stability

40.  Translators

41.  Versioning

Glossary

Index

Data Types and Sizes

D provides fundamental data types for integers and floating-point constants. Arithmetic may only be performed on integers in D programs. Floating-point constants may be used to initialize data structures, but floating-point arithmetic is not permitted in D. D provides a 32-bit and 64-bit data model for use in writing programs. The data model used when executing your program is the native data model associated with the active operating system kernel. You can determine the native data model for your system using isainfo -b.

The names of the integer types and their sizes in each of the two data models are shown in the following table. Integers are always represented in twos-complement form in the native byte-encoding order of your system.

Table 2-2 D Integer Data Types

Type Name
32–bit Size
64–bit Size
char
1 byte
1 byte
short
2 bytes
2 bytes
int
4 bytes
4 bytes
long
4 bytes
8 bytes
long long
8 bytes
8 bytes

Integer types may be prefixed with the signed or unsigned qualifier. If no sign qualifier is present, the type is assumed to be signed. The D compiler also provides the type aliases listed in the following table:

Table 2-3 D Integer Type Aliases

Type Name
Description
int8_t
1 byte signed integer
int16_t
2 byte signed integer
int32_t
4 byte signed integer
int64_t
8 byte signed integer
intptr_t
Signed integer of size equal to a pointer
uint8_t
1 byte unsigned integer
uint16_t
2 byte unsigned integer
uint32_t
4 byte unsigned integer
uint64_t
8 byte unsigned integer
uintptr_t
Unsigned integer of size equal to a pointer

These type aliases are equivalent to using the name of the corresponding base type in the previous table and are appropriately defined for each data model. For example, the type name uint8_t is an alias for the type unsigned char. See Chapter 8, Type and Constant Definitions for information on how to define your own type aliases for use in your D programs.

D provides floating-point types for compatibility with ANSI-C declarations and types. Floating-point operators are not supported in D, but floating-point data objects can be traced and formatted using the printf() function. The floating-point types listed in the following table may be used:

Table 2-4 D Floating-Point Data Types

Type Name
32–bit Size
64–bit Size
float
4 bytes
4 bytes
double
8 bytes
8 bytes
long double
16 bytes
16 bytes

D also provides the special type string to represent ASCII strings. Strings are discussed in more detail in Chapter 6, Strings.