www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - _aApply.../opApply() return type: int or size_t?

reply David Nadlinger <see klickverbot.at> writes:
[repost from dmd-internals]

What should the _aApply... runtime functions, or in general, opApply() 
return? According to the current runtime implementation and 
http://www.digitalmars.com/d/2.0/statement.html, the return type should 
be int, but DMD expects Type::tindex (i.e. size_t) in 
ForeachStatement::semantic().

This is relevant to LDC, where the type is reflected in the backend 
(well, LLVM IR).

David
Apr 29 2011
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 4/29/2011 5:02 PM, David Nadlinger wrote:
 What should the _aApply... runtime functions, or in general, opApply() return?
 According to the current runtime implementation and
 http://www.digitalmars.com/d/2.0/statement.html, the return type should be int,
 but DMD expects Type::tindex (i.e. size_t) in ForeachStatement::semantic().
int
Apr 30 2011
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 4/30/11 12:51 PM, Walter Bright wrote:
 On 4/29/2011 5:02 PM, David Nadlinger wrote:
 What should the _aApply... runtime functions, or in general, opApply()
 return?
 According to the current runtime implementation and
 http://www.digitalmars.com/d/2.0/statement.html, the return type
 should be int,
 but DMD expects Type::tindex (i.e. size_t) in
 ForeachStatement::semantic().
int
I think he was surprised that the current implementation returns size_t. Andrei
Apr 30 2011