can I alias something to void?

Stewart Gordon smjg_1998 at yahoo.com
Wed Jan 17 15:05:57 PST 2007


torhu wrote:
> I'm translating some C headers.
> 
> #define AL_CONST const
> 
> void set_window_title(AL_CONST char *name) { /* ... */ }
> 
> I'm wondering if there is a legitimate way to turn AL_CONST into nothing 
> in D.  This compiles:

Not as such, because D by design has a context-free grammar.  Defining 
an identifier to resolve to textual nothingness would affect the parsing.

> alias void AL_CONST;
> 
> void set_window_title(AL_CONST char *name) { /* ... */ }
<snip>

Another tip: In D pointer declarations, the '*' is strictly associated 
with the type.  So

     char* name

is a preferred style to

     char *name

Stewart.


More information about the Digitalmars-d-learn mailing list