www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Missing code from DMD's 2.003 front-end? (ping Walter)

reply Ary Manzana <ary esperanto.org.ar> writes:
Hi,

While porting DMD's 2.003 source code to Java I realized that in parse.c 
a new method "parseType" with several overloads was added. However, the 
only definition of it is the following:

Type *Parser::parseType(Identifier **pident, TemplateParameters **tpl);

However, in the source code there are several invocations like this:
- parseType(&ai)
- parseType()

This definitely doesn't compile, unless there is some "implicit 
argument" feature in C++ I don't know.

This is blocking my current effort to bring D2 functionality into Descent.

Regards,
Ary
Jul 30 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Ary Manzana wrote:
 Hi,
 
 While porting DMD's 2.003 source code to Java I realized that in parse.c 
 a new method "parseType" with several overloads was added. However, the 
 only definition of it is the following:
 
 Type *Parser::parseType(Identifier **pident, TemplateParameters **tpl);

That's incorrect. In parse.h, the correct definition gives =NULL as the default value for each parameter.
Jul 30 2007
parent reply Ary Manzana <ary esperanto.org.ar> writes:
Walter Bright wrote:
 Ary Manzana wrote:
 Hi,

 While porting DMD's 2.003 source code to Java I realized that in 
 parse.c a new method "parseType" with several overloads was added. 
 However, the only definition of it is the following:

 Type *Parser::parseType(Identifier **pident, TemplateParameters **tpl);

That's incorrect. In parse.h, the correct definition gives =NULL as the default value for each parameter.

Thanks! I didn't know you could assign default parameters in the declaration and not repeat them in the definition.
Jul 31 2007
parent James Dennett <jdennett acm.org> writes:
Ary Manzana wrote:
 Walter Bright wrote:
 Ary Manzana wrote:
 Hi,

 While porting DMD's 2.003 source code to Java I realized that in
 parse.c a new method "parseType" with several overloads was added.
 However, the only definition of it is the following:

 Type *Parser::parseType(Identifier **pident, TemplateParameters **tpl);

That's incorrect. In parse.h, the correct definition gives =NULL as the default value for each parameter.

Thanks! I didn't know you could assign default parameters in the declaration and not repeat them in the definition.

Indeed, repeating them would be an error in C++ (though a later declaration can add additional default argument values). -- James
Jul 31 2007