You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 892 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues
Bug description
typedef [ref,string] char* String;
void f1(const String s); // OK
const String f2(); // line 3, column 15: syntax error
"const" is accepted in paramater definition, but not in the returned type
one. Is this intentional?
Original bug ID: 892
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues
Bug description
typedef [ref,string] char* String;
void f1(const String s); // OK
const String f2(); // line 3, column 15: syntax error
"const" is accepted in paramater definition, but not in the returned type
one. Is this intentional?
typedef [ref,string] char* String;
void f1(const String s);
produces a .c file that compiles with warnings:
...
void camlidl_ml2c_const2_String(value _v1, String * _c2, camlidl_ctx _ctx)
{
(_c2) = camlidl_malloc_string(_v1, _ctx);
}
...
value camlidl_const2_f1(
value _v_s)
{
/
We will fill "s" later so it should not be const!
/
String const s; /in/
struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
camlidl_ctx _ctx = &_ctxs;
/
const2.c
const2.c(36) : warning C4090: 'function' : different 'const' qualifiers
const2.c(36) : warning C4024: 'camlidl_ml2c_const2_String' :
different types for formal and actual parameter 2
*/
camlidl_ml2c_const2_String(_v_s, &s, _ctx);
f1(s);
camlidl_free(_ctx);
return Val_unit;
}
It may even lead to error (not warning) as in the following case (it makes
not much sense, just demonstrates the problem):
IDL:
void f(const int i);
|
V
C:
value camlidl_const3_f(
value _v_i)
{
int const i; /in/
/*
const3.c
const3.c(22) : error C2166: l-value specifies const object
*/
i = Int_val(_v_i);
f(i);
return Val_unit;
}
Not that I cannot live with it, but ...
Hope to hear from you soon,
Dmitry
The text was updated successfully, but these errors were encountered: