Тема: Сішний код у g++
Намагаюся прикрути сішну лібу до cpp. Підкажіть чому g++ не подобається goto
static void
AttributeReadCallback(UA_Client *client, void *userdata,
UA_UInt32 requestId, UA_ReadResponse *rr) {
UA_AttributeReadContext *ctx = (UA_AttributeReadContext*)userdata;
UA_LOG_DEBUG(&UA_Client_getConfig(client)->logger, UA_LOGCATEGORY_CLIENT,
"Async read response for request %" PRIu32, requestId);
/* Check the ServiceResult */
UA_StatusCode res = rr->responseHeader.serviceResult;
if(res != UA_STATUSCODE_GOOD)
goto finish;
/* Check result array size */
if(rr->resultsSize != 1) {
res = UA_STATUSCODE_BADINTERNALERROR;
goto finish;
}
/* A Value attribute */
UA_DataValue *dv = &rr->results[0];
if(ctx->resultType == &UA_TYPES[UA_TYPES_DATAVALUE]) {
ctx->userCallback(client, ctx->userContext, requestId,
UA_STATUSCODE_GOOD, dv);
goto finish;
}
/* An ArrayDimensions attribute. Has to be an array of UInt32. */
if(ctx->resultType == &UA_TYPES[UA_TYPES_VARIANT]) {
if(dv->hasValue &&
UA_Variant_hasArrayType(&dv->value, &UA_TYPES[UA_TYPES_UINT32])) {
ctx->userCallback(client, ctx->userContext, requestId,
UA_STATUSCODE_GOOD, &dv->value);
} else {
res = UA_STATUSCODE_BADINTERNALERROR;
}
goto finish;
}
/* Check we have a scalar value of the right datatype */
if(!dv->hasValue ||
!UA_Variant_hasScalarType(&dv->value, ctx->resultType)) {
res = UA_STATUSCODE_BADINTERNALERROR;
goto finish;
}
/* Callback into userland */
ctx->userCallback(client, ctx->userContext, requestId,
UA_STATUSCODE_GOOD, dv->value.data);
finish://jump to label ‘finish’ [-fpermissive]
if(res != UA_STATUSCODE_GOOD)
ctx->userCallback(client, ctx->userContext, requestId, res, NULL);
UA_free(ctx);
}