Return doesn't really return
Jacob Carlborg
doob at me.com
Sat Aug 4 11:54:13 PDT 2012
On 2012-08-04 19:08, Timon Gehr wrote:
> int opApply (Delegate dg)
> {
> auto result = clang_visitChildren(cursor,
> &visitorFunction,cast(CXClientData) &dg);
> return result == CXChildVisitResult.CXChildVisit_Break ? 1 : 0; //
> culprit
> }
Yes, right. I forgot about that. The Clang API doesn't really have a way
to represent the difference between "break" and "return" in D. The Clang
API works like this:
* Return 0 - Stop visiting children
* Return 1 - Continue visiting children
* Return 2 - Recursively visit the children
It doesn't really seem to be a way to map the difference between the
break and return codes that D uses to the Clang API.
Anyone got an idea for a workaround or should I just continue to use
"break" and never use "return"?
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list