Identifier Names and Keywords
D identifier names are composed of upper case and lower case letters,
digits, and underscores where the first character must be a letter or
underscore. All identifier names beginning with an underscore (_) are reserved for
use by the D system libraries. You should avoid using such names
in your D programs. By convention, D programmers typically use mixed-case names
for variables and all upper case names for constants.
D language keywords are special identifiers reserved for use in the programming
language syntax itself. These names are always specified in lower case and
may not be used for the names of D variables.
Table 2-1 D Keywords
auto* |
goto* |
sizeof |
break* |
if* |
static* |
case* |
import*+ |
string+ |
char |
inline |
stringof+ |
const |
int |
struct |
continue* |
long |
switch* |
counter*+ |
offsetof+ |
this+ |
default* |
probe*+ |
translator+ |
do* |
provider*+ |
typedef |
double |
register* |
union |
else* |
restrict* |
unsigned |
enum |
return* |
void |
extern |
self+ |
volatile |
float |
short |
while* |
for* |
signed |
xlate+ |
D reserves for use as keywords a superset of the ANSI-C keywords.
The keywords reserved for future use by the D language are marked
with “*”. The D compiler will produce a syntax error if you
attempt to use a keyword that is reserved for future use. The
keywords defined by D but not defined by ANSI-C are marked with
“+”. D provides the complete set of types and operators found in
ANSI-C. The major difference in D programming is the absence of control-flow
constructs. Keywords associated with control-flow in ANSI-C are reserved for future use
in D.