www.digitalmars.com         C & C++   DMDScript  

D - C to D page

reply Vathix <vathix dprogramming.com> writes:
 From http://www.digitalmars.com/d/ctod.html,


"Looping through an array" could include foreach.


"Creating an array of variable size" has this bad code:

int array[];
array[array.length++] = x;


"Setting struct member alignment" uses align incorrectly:

struct ABC
{
   ...
   align 1  int x;
...

I saw someone not to long ago ask why their similar align usage didn't 
work, he must have seen it from this.


"Struct initializations" for the D way says "Member initialization is 
done explicitly", shouldn't it say "Member initialization can be done 
explicitly"?


"Creating a new typedef'd type" for the D way has code:

typedef void *Handle;
void foo(void *);
void bar(Handle);
Handle h;
foo(h);			// syntax error
bar(h);			// ok

That is not actually an error due to implicit conversion to Handle's 
underlying type, or is a bug.


-- 
Christopher E. Miller
www.dprogramming.com
irc.dprogramming.com #D
Feb 13 2004
parent J Anderson <REMOVEanderson badmama.com.au> writes:
Vathix wrote:

 From http://www.digitalmars.com/d/ctod.html,
It would be nice if it mentioned conversion from C function pointers to D function pointers as well. -- -Anderson: http://badmama.com.au/~anderson/
Feb 13 2004