www.digitalmars.com         C & C++   DMDScript  

D - More errors on website

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
1. One or two new spelling mistakes.  E.g. "arbitrarilly" has come back
on garbage.html

2. overview.html
synchronize int func() { . }

The word is 'synchronized', isn't it?

3. Frequent use of (type) something in code snippets instead of
cast(type) something.  Shouldn't you be setting an example by using the
D syntax that follows the context-free grammar principle?

I'd also be inclined to add this rule to the D style.

4. Last time I looked, several code snippets also used type *var instead
of type* var, also contrary to the D style and semantics.  I forget
where though.

5. expression.html

	AddExpression:
		MulExpression
		MulExpression + MulExpression
		MulExpression - MulExpression
		MulExpression ~ MulExpression
et al.

As much as you've told us that a + b + c could be evaluated either as (a
  + b) + c or a + (b + c), what you're saying here is that a + b + c is
invalid syntax.  A possible solution is define the grammar as in C,
keeping optimisation of precedence as part of semantic analysis.  (Is
this how DMD actually works at the moment?)

Of course this complication doesn't apply to boolean operators, for which

	OrOrExpression:
		AndAndExpression
		AndAndExpression || AndAndExpression

can clearly be fixed to

	OrOrExpression:
		AndAndExpression
		AndAndExpression || OrOrExpression

and similarly AndAndExpression, without any semantic analysis overhead.

6. While we're still talking about the BNF on expression.html, the
cast(type) notation is completely missing from it.

7. Not sure if this is an error, but UnaryExpression down to
PrimaryExpression looks a bit odd.

	UnaryExpression:
		( Expression )

Shouldn't this be a PrimaryExpression?

	PrimaryExpression:
		Type . Identifier

Shouldn't this be a PostfixExpression?  And doesn't it conflict with
PostfixExpression . Identifier either way?

8. "Casting pointers to non-pointers and vice versa is not allowed in D."

Is this a lie, or a misbug in DMD?  It lets me cast an integer to a
pointer, which is actually necessary in Windows API programming.
(Unless _everything_ in this department can be done with a union....)

9. "There is no else clause for a debug statement, as debug statements 
should add code, not subtract code."

DMD lets me do this too.  A possible application is to change output 
that's in the regular version to be more detailed in debugging builds.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on
on the 'group where everyone may benefit.
Apr 14 2004
next sibling parent reply Ilya Minkov <minkov cs.tum.edu> writes:
Stewart Gordon schrieb:
 8. "Casting pointers to non-pointers and vice versa is not allowed in D."
 
 Is this a lie, or a misbug in DMD?  It lets me cast an integer to a
 pointer, which is actually necessary in Windows API programming.
 (Unless _everything_ in this department can be done with a union....)

Is it necessary? If you mean handles, they can just as well be a typedef on integers, as you may not interpret them as pointers? -eye
Apr 14 2004
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Ilya Minkov wrote:
 Stewart Gordon schrieb:
 
 8. "Casting pointers to non-pointers and vice versa is not allowed in D."

 Is this a lie, or a misbug in DMD?  It lets me cast an integer to a
 pointer, which is actually necessary in Windows API programming.
 (Unless _everything_ in this department can be done with a union....)

Is it necessary? If you mean handles, they can just as well be a typedef on integers, as you may not interpret them as pointers?

std.c.windows.windows defines typedef void *HANDLE; for some strange reason, as do C/C++ headers I've seen for Win32. But what can't be helped is casting a numeric resource ID to an LPSTR, as that's the way the API accepts it. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on on the 'group where everyone may benefit.
Apr 15 2004
prev sibling parent "Walter" <walter digitalmars.com> writes:
Thanks. I'll take care of these. -Walter
Apr 15 2004